tweaks: reshuffle a few things, partly to make two chunks more alike

master
Benno Schulenberg 2019-05-30 15:00:17 +02:00
parent 7e422402d5
commit 6dc8570d55
2 changed files with 19 additions and 22 deletions

View File

@ -301,13 +301,12 @@ char *do_browser(char *path)
} else if (func == (functionptrtype)implant) { } else if (func == (functionptrtype)implant) {
implant(first_sc_for(MBROWSER, func)->expansion); implant(first_sc_for(MBROWSER, func)->expansion);
#endif #endif
} else if (func == do_exit) {
/* Exit from the file browser. */
break;
#ifndef NANO_TINY #ifndef NANO_TINY
} else if (kbinput == KEY_WINCH) { } else if (kbinput == KEY_WINCH) {
; ; /* Nothing to do. */
#endif #endif
} else if (func == do_exit) {
break;
} else } else
unbound_key(kbinput); unbound_key(kbinput);

View File

@ -196,19 +196,16 @@ void do_help(void)
} else if (func == (functionptrtype)implant) { } else if (func == (functionptrtype)implant) {
implant(first_sc_for(MHELP, func)->expansion); implant(first_sc_for(MHELP, func)->expansion);
#endif #endif
#ifndef NANO_TINY
} else if (kbinput == KEY_WINCH) {
; /* Nothing to do. */
#endif
#ifdef ENABLE_MOUSE #ifdef ENABLE_MOUSE
} else if (kbinput == KEY_MOUSE) { } else if (kbinput == KEY_MOUSE) {
int dummy_row, dummy_col; int dummy_row, dummy_col;
get_mouseinput(&dummy_row, &dummy_col, TRUE); get_mouseinput(&dummy_row, &dummy_col, TRUE);
#endif
#ifndef NANO_TINY
} else if (kbinput == KEY_WINCH) {
; /* Nothing to do. */
#endif #endif
} else if (func == do_exit) { } else if (func == do_exit) {
/* Exit from the help viewer. */
close_buffer();
curs_set(0);
break; break;
} else } else
unbound_key(kbinput); 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. */ /* Restore the settings of all flags. */
memcpy(flags, stash, sizeof(flags)); memcpy(flags, stash, sizeof(flags));
@ -238,8 +239,14 @@ void do_help(void)
syntaxstr = was_syntax; syntaxstr = was_syntax;
#endif #endif
/* Switch back to the buffer we were invoked from. */ free(title);
openfile = openfile->prev; title = NULL;
free(answer);
answer = saved_answer;
free(help_text);
inhelp = FALSE;
curs_set(0);
if (ISSET(NO_HELP)) { if (ISSET(NO_HELP)) {
currmenu = oldmenu; currmenu = oldmenu;
@ -247,21 +254,12 @@ void do_help(void)
} else } else
bottombars(oldmenu); bottombars(oldmenu);
free(title);
title = NULL;
inhelp = FALSE;
#ifdef ENABLE_BROWSER #ifdef ENABLE_BROWSER
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR) if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
browser_refresh(); browser_refresh();
else else
#endif #endif
total_refresh(); total_refresh();
free(answer);
answer = saved_answer;
free(help_text);
} }
/* Allocate space for the help text for the current menu, and concatenate /* Allocate space for the help text for the current menu, and concatenate