mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibLine: Make clear_lines() work when only clearing the current line
This commit is contained in:
parent
6472e5239c
commit
9790ee4649
Notes:
sideshowbarker
2024-07-18 22:04:30 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/9790ee4649f Pull-request: https://github.com/SerenityOS/serenity/pull/5441 Issue: https://github.com/SerenityOS/serenity/issues/5440
1 changed files with 10 additions and 6 deletions
|
@ -1531,12 +1531,16 @@ void VT::apply_style(const Style& style, bool is_starting)
|
|||
|
||||
void VT::clear_lines(size_t count_above, size_t count_below)
|
||||
{
|
||||
// Go down count_below lines.
|
||||
if (count_below > 0)
|
||||
fprintf(stderr, "\033[%dB", (int)count_below);
|
||||
// Then clear lines going upwards.
|
||||
for (size_t i = count_below + count_above; i > 0; --i)
|
||||
fputs(i == 1 ? "\033[2K" : "\033[2K\033[A", stderr);
|
||||
if (count_below + count_above == 0) {
|
||||
fputs("\033[2K", stderr);
|
||||
} else {
|
||||
// Go down count_below lines.
|
||||
if (count_below > 0)
|
||||
fprintf(stderr, "\033[%dB", (int)count_below);
|
||||
// Then clear lines going upwards.
|
||||
for (size_t i = count_below + count_above; i > 0; --i)
|
||||
fputs(i == 1 ? "\033[2K" : "\033[2K\033[A", stderr);
|
||||
}
|
||||
}
|
||||
|
||||
void VT::save_cursor()
|
||||
|
|
Loading…
Reference in a new issue