From d8b6dbfffee8e293327ae0b57b500011600b09a1 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 7 Apr 2015 14:16:07 +0000 Subject: [PATCH] Letting bottombars() set the global variable 'currmenu'. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5183 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/browser.c | 3 --- src/files.c | 4 ---- src/help.c | 9 ++------- src/prompt.c | 1 - src/text.c | 3 --- src/winio.c | 3 +++ 7 files changed, 8 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f6f5e69..a4083d0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ 'focusing' when searching only for filenames. * src/browser.c (findnextfile, do_filesearch, do_fileresearch): Greatly simplify the searching for the next matching filename. + * src/{browser,files,help,prompt,text,winio}.c: Let the function + bottombars() set the global variable 'currmenu' -- the displayed + menu must necessarily be the active one. 2015-04-05 Benno Schulenberg * doc/texinfo/nano.texi: Expand on nano's features, condense the diff --git a/src/browser.c b/src/browser.c index 4285395e..7b631fff 100644 --- a/src/browser.c +++ b/src/browser.c @@ -60,7 +60,6 @@ char *do_browser(char *path, DIR *dir) curs_set(0); blank_statusbar(); - currmenu = MBROWSER; bottombars(MBROWSER); wnoutrefresh(bottomwin); @@ -197,7 +196,6 @@ char *do_browser(char *path, DIR *dir) browser_refresh, _("Go To Directory")); curs_set(0); - currmenu = MBROWSER; bottombars(MBROWSER); /* If the directory begins with a newline (i.e. an @@ -823,7 +821,6 @@ void findnextfile(const char *needle) * shortcut list to the browser shortcut list, and displaying it. */ void filesearch_abort(void) { - currmenu = MBROWSER; bottombars(MBROWSER); } diff --git a/src/files.c b/src/files.c index 65c151be..dd4b2c55 100644 --- a/src/files.c +++ b/src/files.c @@ -1049,8 +1049,6 @@ void do_insertfile( bool right_side_up = FALSE, single_line = FALSE; #endif - currmenu = MINSERTFILE; - while (TRUE) { #ifndef NANO_TINY if (execute) { @@ -2252,8 +2250,6 @@ bool do_writeout(bool exiting) #endif bool retval = FALSE; - currmenu = MWRITEFILE; - if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) { retval = write_file(openfile->filename, NULL, FALSE, OVERWRITE, FALSE); diff --git a/src/help.c b/src/help.c index 8bda2386..a14fcbc9 100644 --- a/src/help.c +++ b/src/help.c @@ -62,10 +62,6 @@ void do_help(void (*refresh_func)(void)) assert(help_text != NULL); - /* Set currmenu to allow clicking on the help screen's shortcut - * list, after help_init() is called. */ - currmenu = MHELP; - if (ISSET(NO_HELP)) { /* Make sure that the help screen's shortcut list will actually * be displayed. */ @@ -158,15 +154,14 @@ void do_help(void (*refresh_func)(void)) } } - currmenu = oldmenu; - if (old_no_help) { blank_bottombars(); wnoutrefresh(bottomwin); + currmenu = oldmenu; SET(NO_HELP); window_init(); } else - bottombars(currmenu); + bottombars(oldmenu); curs_set(1); refresh_func(); diff --git a/src/prompt.c b/src/prompt.c index 0729dc2f..89d0a86c 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -969,7 +969,6 @@ int do_prompt(bool allow_tabs, prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1); - currmenu = menu; bottombars(menu); va_start(ap, msg); diff --git a/src/text.c b/src/text.c index 14ca49e8..4b41eaa1 100644 --- a/src/text.c +++ b/src/text.c @@ -2213,7 +2213,6 @@ void do_justify(bool full_justify) /* Display the shortcut list with UnJustify. */ uncutfunc->desc = unjust_tag; - currmenu = MMAIN; display_main_list(); /* Now get a keystroke and see if it's unjustify. If not, put back @@ -2914,7 +2913,6 @@ void do_spell(void) /* Cleanup things to do after leaving the linter. */ void lint_cleanup(void) { - currmenu = MMAIN; display_main_list(); } @@ -3129,7 +3127,6 @@ void do_linter(void) return; } - currmenu = MLINTER; bottombars(MLINTER); tmplint = NULL; curlint = lints; diff --git a/src/winio.c b/src/winio.c index 12bc2de8..9d6587a4 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2344,6 +2344,9 @@ void bottombars(int menu) subnfunc *f; const sc *s; + /* Set the global variable to the given menu. */ + currmenu = menu; + if (ISSET(NO_HELP)) return; -- 2.39.5