From 6dc8570d55aa5d3e290fdd71a3d69ecb23be5042 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 30 May 2019 15:00:17 +0200 Subject: [PATCH] tweaks: reshuffle a few things, partly to make two chunks more alike --- src/browser.c | 7 +++---- src/help.c | 34 ++++++++++++++++------------------ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/browser.c b/src/browser.c index 5baf93c7..efd53635 100644 --- a/src/browser.c +++ b/src/browser.c @@ -301,13 +301,12 @@ char *do_browser(char *path) } else if (func == (functionptrtype)implant) { implant(first_sc_for(MBROWSER, func)->expansion); #endif - } else if (func == do_exit) { - /* Exit from the file browser. */ - break; #ifndef NANO_TINY } else if (kbinput == KEY_WINCH) { - ; + ; /* Nothing to do. */ #endif + } else if (func == do_exit) { + break; } else unbound_key(kbinput); diff --git a/src/help.c b/src/help.c index a0982431..89dbde75 100644 --- a/src/help.c +++ b/src/help.c @@ -196,19 +196,16 @@ void do_help(void) } else if (func == (functionptrtype)implant) { implant(first_sc_for(MHELP, func)->expansion); #endif -#ifndef NANO_TINY - } else if (kbinput == KEY_WINCH) { - ; /* Nothing to do. */ -#endif #ifdef ENABLE_MOUSE } else if (kbinput == KEY_MOUSE) { int dummy_row, dummy_col; get_mouseinput(&dummy_row, &dummy_col, TRUE); +#endif +#ifndef NANO_TINY + } else if (kbinput == KEY_WINCH) { + ; /* Nothing to do. */ #endif } else if (func == do_exit) { - /* Exit from the help viewer. */ - close_buffer(); - curs_set(0); break; } else unbound_key(kbinput); @@ -226,6 +223,10 @@ void do_help(void) } } + close_buffer(); + /* Switch back to the buffer we were invoked from. */ + openfile = openfile->prev; + /* Restore the settings of all flags. */ memcpy(flags, stash, sizeof(flags)); @@ -238,8 +239,14 @@ void do_help(void) syntaxstr = was_syntax; #endif - /* Switch back to the buffer we were invoked from. */ - openfile = openfile->prev; + free(title); + title = NULL; + free(answer); + answer = saved_answer; + free(help_text); + inhelp = FALSE; + + curs_set(0); if (ISSET(NO_HELP)) { currmenu = oldmenu; @@ -247,21 +254,12 @@ void do_help(void) } else bottombars(oldmenu); - free(title); - title = NULL; - inhelp = FALSE; - #ifdef ENABLE_BROWSER if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR) browser_refresh(); else #endif total_refresh(); - - free(answer); - answer = saved_answer; - - free(help_text); } /* Allocate space for the help text for the current menu, and concatenate