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 e67e16b268f12eb7794012ebe9948bc6324efc61
parent 81a48d48ed0129181607129cb4f21823a71cfe32
Author: René Wagner <rwa@clttr.info>
Date:   Mon,  7 Feb 2022 20:49:01 +0100

restore current url after usage of t[N] command

fixes #24

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

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -625,6 +625,7 @@ do_prompts(const char *prompt, struct browser *browser) in[n - 1] = 0; // Remove LF char url[1024] = {0}; + char save_url[1024] = {0}; int r; switch (in[0]) { case '\0': @@ -749,6 +750,7 @@ do_prompts(const char *prompt, struct browser *browser) case 'e': case 'p': case 't': + strncpy(&save_url[0], browser->plain_url, sizeof(url)-1); if (!in[1]) { strncpy(&url[0], browser->plain_url, sizeof(url)-1); } else { @@ -770,7 +772,7 @@ do_prompts(const char *prompt, struct browser *browser) char *tempfile; if (in[0] == 't') { struct gemini_response resp; - set_url(browser, url, &browser->history); + set_url(browser, url, NULL); enum gemini_result res = do_requests(browser, &resp); if (res != GEMINI_OK) { fprintf(stderr, "Error: %s\n", @@ -780,7 +782,7 @@ do_prompts(const char *prompt, struct browser *browser) download_resp(browser->tty, resp, tempfile, url); } gemini_response_finish(&resp); - set_url(browser, url, NULL); + set_url(browser, save_url, NULL); } if (in[0] == 'e' || browser->autoopen) { char target[1024];