cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 7e921064201df7a52bd77bedc10b0f0b4b80cf30
parent 58aa37983670caf6736535790d4bf53f766032d6
Author: Ondřej Fiala <fiala.ondrej@volny.cz>
Date:   Tue, 21 Nov 2023 02:03:49 +0100

gmnlm: update window size on every request to display more

Diffstat:
Msrc/gmnlm.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -1082,12 +1082,6 @@ display_gemini(struct browser *browser, struct gemini_response *resp) free(browser->page_title); browser->page_title = NULL; - struct winsize ws; - ioctl(fileno(browser->tty), TIOCGWINSZ, &ws); - if (browser->max_width != 0 && ws.ws_col > browser->max_width) { - ws.ws_col = browser->max_width; - } - FILE *out = browser->tty; bool searching = browser->searching; if (searching) { @@ -1102,12 +1096,18 @@ display_gemini(struct browser *browser, struct gemini_response *resp) struct link **next = &browser->links; char prompt[4096]; - char *end = NULL; int info_rows = 0; + struct winsize ws; bool first_screen = 1; while (text != NULL || gemini_parser_next(&p, &tok) == 0) { repeat: if (!row) { + ioctl(fileno(browser->tty), TIOCGWINSZ, &ws); + if (browser->max_width != 0 && ws.ws_col > browser->max_width) { + ws.ws_col = browser->max_width; + } + + char *end = NULL; if (browser->meta && (end = strchr(resp->meta, ';')) != NULL) { *end = 0; }