From 0f83c89b099b7e0b3fadf950073a35a3820591ca Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 3 May 2005 03:18:44 +0000 Subject: [PATCH] rearrange nanogetstr() to fix breakage git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2498 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 ++- src/global.c | 2 +- src/winio.c | 21 ++++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64e300bb..3672429f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,7 +10,8 @@ CVS code - - Use separate keys to go to the previous and next strings in the search/replace history, and display them as "^P" and "^N". This makes mouse clicks work properly on them. Changes to - shortcut_init(), help_init(), and do_statusbar_input(). (DLR) + shortcut_init(), help_init(), nanogetstr(), and + do_statusbar_input(). (DLR) - files.c: load_open_file() - Remove an unneeded clearok(FALSE). (DLR) diff --git a/src/global.c b/src/global.c index 1c82487a..05adf5a8 100644 --- a/src/global.c +++ b/src/global.c @@ -712,7 +712,7 @@ void shortcut_init(bool unjustify) IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, NANO_NO_KEY, VIEW, do_last_line); - /* Translators: try to keep this string under 12 characters long */ + /* Translators: try to keep this string under 10 characters long */ sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"), IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, NANO_NO_KEY, VIEW, NULL); diff --git a/src/winio.c b/src/winio.c index 6493e5c9..8aa4939a 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2492,12 +2492,6 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, &s_or_t, &ran_func, &finished, TRUE)) != NANO_CANCEL_KEY && kbinput != NANO_ENTER_KEY) { - /* If we have a shortcut with an associated function, break out - * if we're finished after running or trying to run the - * function. */ - if (ran_func && finished) - break; - assert(statusbar_x <= answer_len && answer_len == strlen(answer)); if (kbinput != NANO_TAB_KEY) @@ -2521,6 +2515,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, answer_len = strlen(answer); statusbar_x = answer_len; } + finished = FALSE; } #ifndef DISABLE_TABCOMP else @@ -2531,6 +2526,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, answer = input_tab(answer, &statusbar_x, &tabbed, list); answer_len = strlen(answer); + finished = FALSE; } #endif break; @@ -2562,7 +2558,6 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, free(currentbuf); currentbuf = NULL; use_cb = 0; - /* Otherwise, get the older search from the history * list and save it in answer. */ } else if ((history = @@ -2570,8 +2565,8 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, answer = mallocstrcpy(answer, history); answer_len = strlen(history); } - statusbar_x = answer_len; + finished = FALSE; } #endif break; @@ -2584,7 +2579,6 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, get_history_newer(history_list)) != NULL) { answer = mallocstrcpy(answer, history); answer_len = strlen(history); - /* If currentbuf isn't NULL and use_cb isn't 2, it * means that we're scrolling down at the bottom of * the search history and we need to restore the @@ -2597,7 +2591,6 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, free(currentbuf); currentbuf = NULL; use_cb = 1; - /* Otherwise, if currentbuf is NULL and use_cb isn't * 2, it means that we're scrolling down at the * bottom of the search history and we need to save @@ -2613,13 +2606,19 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, answer_len = 0; use_cb = 2; } - statusbar_x = answer_len; + finished = FALSE; } #endif break; } + /* If we have a shortcut with an associated function, break out + * if we're finished after running or trying to run the + * function. */ + if (finished) + break; + #ifndef NANO_SMALL last_kbinput = kbinput; #endif