commit 5618189643f285d40f7c92048e59813512d86b48
parent cf634d1aff374edca3929be2333de150fa155f12
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 6 Feb 2019 14:51:53 +0100
prompt: trim a double-width character at the screen's edge
It needs to be trimmed and substituted with a single-width placeholder
to prevent the continuation character ">" from getting pushed to the
next row.
Also, use the correct width for the answer so that the continuation
character is only displayed when the answer does not fit any more.
This fixes https://savannah.gnu.org/bugs/?55620.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
Original-patch-by: David Lawrence Ramsey <pooka109@gmail.com>
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/prompt.c b/src/prompt.c
@@ -395,11 +395,12 @@ void draw_the_promptbar(void)
waddch(bottomwin, ':');
waddch(bottomwin, (the_page == 0) ? ' ' : '<');
- expanded = display_string(answer, the_page, COLS - base - 1, FALSE);
+ expanded = display_string(answer, the_page, COLS - base, FALSE);
waddstr(bottomwin, expanded);
free(expanded);
- waddch(bottomwin, (the_page >= end_page) ? ' ' : '>');
+ if (base + strlenpt(answer) != COLS && the_page < end_page)
+ mvwaddch(bottomwin, 0, COLS - 1, '>');
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
diff --git a/src/winio.c b/src/winio.c
@@ -1988,7 +1988,8 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
}
/* If there is more text than can be shown, make room for the $ or >. */
- if ((*buf != '\0' || column > beyond) && isdata && !ISSET(SOFTWRAP)) {
+ if ((*buf != '\0' || column > beyond) &&
+ (currmenu != MMAIN || (isdata && !ISSET(SOFTWRAP)))) {
index = move_mbleft(converted, index);
#ifdef ENABLE_UTF8