prompt: leave always at least the last character of the answer visible

This fixes https://savannah.gnu.org/bugs/?48912.
master
Benno Schulenberg 2016-08-26 21:29:53 +02:00
parent b77b1391c3
commit 92c97c70d4
1 changed files with 6 additions and 4 deletions

View File

@ -431,11 +431,12 @@ size_t statusbar_xplustabs(void)
* get_statusbar_page_start(column) < COLS). */ * get_statusbar_page_start(column) < COLS). */
size_t get_statusbar_page_start(size_t start_col, size_t column) size_t get_statusbar_page_start(size_t start_col, size_t column)
{ {
if (column == start_col || column < COLS - 1 || COLS == start_col + 1) if (column == start_col || column < COLS - 1)
return 0; return 0;
else if (COLS > start_col + 2)
return column - start_col - 1 - (column - start_col - 1) % (COLS - start_col - 2);
else else
return column - start_col - (column - start_col) % (COLS - return column - 2;
start_col - 1);
} }
/* Reinitialize the cursor position in the status bar prompt. */ /* Reinitialize the cursor position in the status bar prompt. */
@ -724,7 +725,8 @@ int do_prompt(bool allow_tabs,
va_start(ap, msg); va_start(ap, msg);
vsnprintf(prompt, COLS * mb_cur_max(), msg, ap); vsnprintf(prompt, COLS * mb_cur_max(), msg, ap);
va_end(ap); va_end(ap);
null_at(&prompt, actual_x(prompt, (COLS < 4) ? 0 : COLS - 4)); /* Reserve five columns for colon plus dollars plus answer, ":$aa$". */
null_at(&prompt, actual_x(prompt, (COLS < 5) ? 0 : COLS - 5));
func = acquire_an_answer(&retval, allow_tabs, func = acquire_an_answer(&retval, allow_tabs,
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP