sacc

sacc(omys), simple console gopher client (mirror)
git clone https://git.parazyd.org/sacc
Log | Files | Refs | LICENSE

commit 9cc56dc59541a6a7d71faab023000516b74bf994
parent f4e8624533fdf8beac682088523b91f14b44e920
Author: Quentin Rameau <quinq@fifth.space>
Date:   Fri,  7 Jul 2017 22:00:01 +0200

Adjust cursor place when moving around pages

Diffstat:
Mui_ti.c | 22++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/ui_ti.c b/ui_ti.c @@ -185,17 +185,23 @@ jumptoline(Item *entry, ssize_t offset) return; entry->printoff = 0; entry->curline = 0; - } else if (offset + plines > nitems) { - if (entry->curline == nitems-1) - return; - if (nitems > plines) - entry->printoff = nitems-1 - plines; - else - entry->printoff = 0; + } else if (offset + plines < nitems) { + entry->printoff = offset; + entry->curline = offset; + } else if (entry->curline == nitems-1) { + return; + } else if (nitems < plines) { + entry->curline = nitems-1; + } else if (offset == nitems) { + entry->printoff = nitems-1 - plines; entry->curline = nitems-1; } else { + offset = nitems-1 - plines; + if (entry->printoff == offset) + entry->curline = nitems-1; + else if (entry->curline < offset) + entry->curline = offset; entry->printoff = offset; - entry->curline = entry->printoff; } display(entry);