mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 18:40:42 +08:00
Clear line if new indentation greater than old.
Make sure initial indentation is skipped, rather than written as spaces. This is a tweak to pull request #5928.
This commit is contained in:
parent
eca1fcad90
commit
dfc45f3e10
|
@ -668,7 +668,6 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring
|
||||||
size_t skip_prefix = shared_prefix;
|
size_t skip_prefix = shared_prefix;
|
||||||
if (shared_prefix < o_line.indentation) {
|
if (shared_prefix < o_line.indentation) {
|
||||||
if (o_line.indentation > s_line.indentation
|
if (o_line.indentation > s_line.indentation
|
||||||
&& s_line.indentation != s_line.size()
|
|
||||||
&& !has_cleared_screen && clr_eol && clr_eos) {
|
&& !has_cleared_screen && clr_eol && clr_eos) {
|
||||||
s_set_color(scr, vars, highlight_spec_t{});
|
s_set_color(scr, vars, highlight_spec_t{});
|
||||||
s_move(scr, 0, (int)i);
|
s_move(scr, 0, (int)i);
|
||||||
|
@ -679,7 +678,7 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring
|
||||||
}
|
}
|
||||||
skip_prefix = o_line.indentation;
|
skip_prefix = o_line.indentation;
|
||||||
}
|
}
|
||||||
if (!should_clear_screen_this_line) {
|
|
||||||
// Compute how much we should skip. At a minimum we skip over the prompt. But also skip
|
// Compute how much we should skip. At a minimum we skip over the prompt. But also skip
|
||||||
// over the shared prefix of what we want to output now, and what we output before, to
|
// over the shared prefix of what we want to output now, and what we output before, to
|
||||||
// avoid repeatedly outputting it.
|
// avoid repeatedly outputting it.
|
||||||
|
@ -689,6 +688,7 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring
|
||||||
if (skip_width > skip_remaining) skip_remaining = skip_width;
|
if (skip_width > skip_remaining) skip_remaining = skip_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!should_clear_screen_this_line) {
|
||||||
// If we're soft wrapped, and if we're going to change the first character of the next
|
// If we're soft wrapped, and if we're going to change the first character of the next
|
||||||
// line, don't skip over the last two characters so that we maintain soft-wrapping.
|
// line, don't skip over the last two characters so that we maintain soft-wrapping.
|
||||||
if (o_line.is_soft_wrapped && i + 1 < scr->desired.line_count()) {
|
if (o_line.is_soft_wrapped && i + 1 < scr->desired.line_count()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user