nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 801b3ce67591b782dbdd004a3e011b10c29d0203
parent acf19bde227f5cdfe0389a84419ae2250be761b1
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun, 21 Feb 2016 13:33:52 +0000

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

Diffstat:
MChangeLog | 4++++
Msrc/files.c | 12+++++-------
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,7 @@ +2016-02-21 Benno Schulenberg <bensberg@justemail.net> + * 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 <bensberg@justemail.net> * 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 @@ -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. */