From d3ceba107e88b6c6e1a0358ebcb30366aeef653f Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 17 May 2021 21:44:17 -0700 Subject: [PATCH] Clear to eol before outputting line in multi-line prompt If the user has a multi-line prompt, we will emit a clr_eol on every line except the last (see #7404). Prior to this change we would emit clr_eol after the line, but in some terminals, if the line extended the width of the tty, the last character would be deleted. Switch to emitting clr_eol first; now the last character will not be cut off. Fixes #8002 --- src/screen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screen.cpp b/src/screen.cpp index 7d43ec2d0..0a0de62a5 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -739,10 +739,10 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring s_move(scr, 0, 0); size_t start = 0; for (const size_t line_break : left_prompt_layout.line_breaks) { - s_write_str(scr, left_prompt.substr(start, line_break - start).c_str()); if (clr_eol) { s_write_mbs(scr, clr_eol); } + s_write_str(scr, left_prompt.substr(start, line_break - start).c_str()); start = line_break; } s_write_str(scr, left_prompt.c_str() + start);