From: Benno Schulenberg Date: Sun, 21 Feb 2016 13:33:52 +0000 (+0000) Subject: Not requiring a third Tab to show the list of possible completions X-Git-Tag: v2.5.3~24 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=801b3ce67591b782dbdd004a3e011b10c29d0203;p=nano.git Not requiring a third Tab to show the list of possible completions when the first Tab added the part that all matches have in common. So now two Tabs in a row will always show the list of possible completions -- if there /are/ any completions. Which means that a second Tab will either: 1) do nothing, when the name is complete and exists; 2) beep, when nothing in the current directory starts with the current string; 3) show the list of matches. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5656 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 78fcce05..b7e9914f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-02-21 Benno Schulenberg + * src/files.c (input_tab): If the first Tab added the part that all + matches have in common, don't require a third Tab to show the list. + 2016-02-20 Benno Schulenberg * src/search.c (get_history_completion): Avoid leaking memory when tabbing on a string that does not occur in the history. diff --git a/src/files.c b/src/files.c index ad6779bd..ad434c60 100644 --- a/src/files.c +++ b/src/files.c @@ -2855,20 +2855,18 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool if (num_matches > 1 && (common_len != *place || !*lastwastab)) beep(); - /* If there is more of a match to display on the statusbar, show - * it. We reset lastwastab to FALSE: it requires pressing Tab - * twice in succession with no statusbar changes to see a match - * list. */ + /* If the matches have something in common, show that part. */ if (common_len != *place) { - *lastwastab = FALSE; buf = charealloc(buf, common_len + buf_len - *place + 1); charmove(buf + common_len, buf + *place, buf_len - *place + 1); strncpy(buf, mzero, common_len); *place = common_len; - } else if (!*lastwastab || num_matches < 2) + } + + if (!*lastwastab) *lastwastab = TRUE; - else { + else if (num_matches > 1) { int longest_name = 0, ncols, editline = 0; /* Now we show a list of the available choices. */