tabbing: beep at the first listing, and when there are zero possibilities

A successful single completion is silent, but when there are zero
or multiple possibilities, nano beeps.
This commit is contained in:
Benno Schulenberg 2020-06-25 10:10:49 +02:00
parent 3f63982593
commit 94f49e208f

View File

@ -2555,7 +2555,8 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
memmove(buf + common_len, buf + *place, 1); memmove(buf + common_len, buf + *place, 1);
strncpy(buf, mzero, common_len); strncpy(buf, mzero, common_len);
*place = common_len; *place = common_len;
} } else if (num_matches == 1)
beep();
/* If there is more than one possible completion, show a sorted list. */ /* If there is more than one possible completion, show a sorted list. */
if (num_matches > 1) { if (num_matches > 1) {
@ -2563,6 +2564,9 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
size_t nrows, ncols; size_t nrows, ncols;
int row; int row;
if (!*listed)
beep();
qsort(matches, num_matches, sizeof(char *), diralphasort); qsort(matches, num_matches, sizeof(char *), diralphasort);
/* Find the length of the longest name among the matches. */ /* Find the length of the longest name among the matches. */