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
master
Benno Schulenberg 2016-02-21 13:33:52 +00:00
parent acf19bde22
commit 801b3ce675
2 changed files with 9 additions and 7 deletions

View File

@ -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.

View File

@ -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. */