tabbing: also with --zero, stay one row away from the prompt bar

When <Tab> at a prompt shows a list of filenames, this list should
not "sit" on the prompt bar but float one row above it.

This addresses the third issue mentioned in commit 03637030.
master
Benno Schulenberg 2021-11-14 16:57:07 +01:00
parent a2a00577cd
commit d93a5594cd
1 changed files with 3 additions and 2 deletions

View File

@ -2626,6 +2626,7 @@ char *input_tab(char *morsel, size_t *place, void (*refresh_func)(void), bool *l
/* If there is more than one possible completion, show a sorted list. */
if (num_matches > 1) {
int lastrow = editwinrows - 1 - (ISSET(ZERO) && LINES > 1 ? 1 : 0);
size_t longest_name = 0;
size_t nrows, ncols;
int row;
@ -2651,7 +2652,7 @@ char *input_tab(char *morsel, size_t *place, void (*refresh_func)(void), bool *l
ncols = (COLS + 1) / (longest_name + 2);
nrows = (num_matches + ncols - 1) / ncols;
row = (nrows < editwinrows - 1) ? editwinrows - nrows - 1 : 0;
row = (nrows < lastrow) ? lastrow - nrows : 0;
/* Blank the edit window and hide the cursor. */
blank_edit();
@ -2663,7 +2664,7 @@ char *input_tab(char *morsel, size_t *place, void (*refresh_func)(void), bool *l
wmove(edit, row, (longest_name + 2) * (match % ncols));
if (row == editwinrows - 1 && (match + 1) % ncols == 0 &&
if (row == lastrow && (match + 1) % ncols == 0 &&
match + 1 < num_matches) {
waddstr(edit, _("(more)"));
break;