cgmnlm

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/cgmnlm.git
Log | Files | Refs | README | LICENSE

commit b54a100d7156ea279641a9e779b7658c42300fe9
parent 8ddc99fdc336957d7565cd50e329da9cbe9e4de8
Author: Zach DeCook <zachdecook@librem.one>
Date:   Fri,  2 Apr 2021 09:31:00 -0400

gmnlm: Improve paging behavior on narrow terminals

Diffstat:
Msrc/gmnlm.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -948,6 +948,10 @@ display_gemini(struct browser *browser, struct gemini_response *resp) bool no_alttext; struct gemini_token tok; struct link **next = &browser->links; + // When your screen is too narrow, more lines will be used for helptext and URL. + // 87 is the maximum width of the prompt. + int info_rows = (ws.ws_col >= 87) ? 4 : 6; + while (text != NULL || gemini_parser_next(&p, &tok) == 0) { repeat: switch (tok.token) { @@ -1043,7 +1047,7 @@ repeat: if (text) { int w = wrap(out, text, &ws, &row, &col); text += w; - if (text[0] && row < ws.ws_row - 4) { + if (text[0] && row < ws.ws_row - info_rows) { continue; } @@ -1062,7 +1066,7 @@ repeat: ++row; col = 0; fprintf(out, ANSI_COLOR_RESET); - if (browser->pagination && row >= ws.ws_row - 4) { + if (browser->pagination && row >= ws.ws_row - info_rows) { char prompt[4096]; char *end = NULL; if (browser->meta && (end = strchr(resp->meta, ';')) != NULL) {