From 1e3cffbbd6798bc2e2f2b8abbf430ea38f894428 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Fri, 26 Aug 2016 21:42:23 +0200
Subject: [PATCH] prompt: show a trailing $ when the tail of the answer is
 offscreen

This fixes https://savannah.gnu.org/bugs/?48894.
---
 src/prompt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/prompt.c b/src/prompt.c
index 53a826a9..85de27a2 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -466,7 +466,7 @@ void reset_statusbar_cursor(void)
 /* Repaint the statusbar. */
 void update_the_statusbar(void)
 {
-    size_t start_col, index, page_start;
+    size_t start_col, index, page_start, page_end;
     char *expanded;
 
     assert(prompt != NULL && statusbar_x <= strlen(answer));
@@ -474,6 +474,7 @@ void update_the_statusbar(void)
     start_col = strlenpt(prompt) + 2;
     index = strnlenpt(answer, statusbar_x);
     page_start = get_statusbar_page_start(start_col, start_col + index);
+    page_end = get_statusbar_page_start(start_col, start_col + strlenpt(answer) - 1);
 
     wattron(bottomwin, interface_color_pair[TITLE_BAR]);
 
@@ -487,6 +488,8 @@ void update_the_statusbar(void)
     waddstr(bottomwin, expanded);
     free(expanded);
 
+    waddch(bottomwin, (page_start >= page_end) ? ' ' : '$');
+
     wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
 
     statusbar_pww = statusbar_xplustabs();
-- 
GitLab