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
commit 1c4a425bff
Notes: sideshowbarker 2024-07-19 00:07:27 +09:00
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();