sfeed_curses

[fork] sfeed (atom feed) reader
Log | Files | Refs | README | LICENSE

commit 1ba16914d843ab67cd155d99e1ffe4ab1e180e22
parent c530fa092daa4204ebe0e7a0c798d12d25cb9af9
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun,  5 Jul 2020 22:59:53 +0200

setpos: a simplification and pedantic fix

No functional differences.

- No difference because p->nrows was clamped to p->nrows - 1 already.
- Fix comment: it checks if the items are on a different (visible) scroll
  region, not the screen.

Diffstat:
Msfeed_curses.c | 9+++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sfeed_curses.c b/sfeed_curses.c @@ -640,7 +640,7 @@ pane_setpos(struct pane *p, off_t pos) if (pos >= p->nrows) pos = p->nrows - 1; /* clamp */ - /* is on different screen? mark dirty */ + /* is on different scroll region? mark dirty */ if (((p->pos - (p->pos % p->height)) / p->height) != ((pos - (pos % p->height)) / p->height)) { p->pos = pos; @@ -664,7 +664,7 @@ pane_setstartpos(struct pane *p) void pane_setendpos(struct pane *p) { - pane_setpos(p, p->nrows); + pane_setpos(p, p->nrows - 1); } void @@ -688,10 +688,7 @@ pane_scrollpage(struct pane *p, int pages) void pane_scrolln(struct pane *p, int n) { - if (n < 0) - pane_setpos(p, p->pos + n); - else if (n > 0) - pane_setpos(p, p->pos + n); + pane_setpos(p, p->pos + n); } void