]> git.wh0rd.org Git - nano.git/commitdiff
rearrange nanogetstr() to fix breakage
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Tue, 3 May 2005 03:18:44 +0000 (03:18 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Tue, 3 May 2005 03:18:44 +0000 (03:18 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2498 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/global.c
src/winio.c

index 64e300bb7754a1f4721e912f802f7b02b7e1936e..3672429f9b56fa740e69ea483a86f54b3883795c 100644 (file)
--- 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)
index 1c82487a67e12741ae16e565c6e62b702366c4d0..05adf5a8aa661b6caa25d43f858d615a7e59b582 100644 (file)
@@ -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);
index 6493e5c91ca95586339d60ad95bcb4ee0c8ccca5..8aa4939afe47aef69e4d0842d18c68ed26e57fe2 100644 (file)
@@ -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