1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibLine: Don't overwrite stuff when moving origin around

This fixes an issue (mainly) with multiline prompts, where a multiline
prompt would overwrite the lines before it when libline tries to display
it.
To reproduce, set `PROMPT="a\nb\nc> "` in the shell, then press return
a few times.
This commit is contained in:
AnotherTest 2021-01-04 11:38:56 +03:30 committed by Andreas Kling
parent 1f03b6ad57
commit 1c4a425bff
3 changed files with 56 additions and 18 deletions

View file

@ -37,6 +37,7 @@ struct StringMetrics {
size_t max_line_length { 0 };
size_t lines_with_addition(const StringMetrics& offset, size_t column_width) const;
size_t offset_with_addition(const StringMetrics& offset, size_t column_width) const;
void reset()
{
line_lengths.clear();