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
This commit is contained in:
ridiculousfish 2021-05-17 21:44:17 -07:00
parent c0b33774ca
commit d3ceba107e

View file

@ -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);