commit d93a5594cd80c06ecb2ef8bbedd53a10d4622847
parent a2a00577cd151a05efc064410e06c21797422a1b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 14 Nov 2021 16:57:07 +0100
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.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -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;