mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +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:
parent
1f03b6ad57
commit
1c4a425bff
3 changed files with 56 additions and 18 deletions
|
@ -349,10 +349,7 @@ private:
|
|||
if (cursor > m_cursor)
|
||||
cursor = m_cursor;
|
||||
auto buffer_metrics = actual_rendered_string_metrics(buffer_view().substring_view(0, cursor));
|
||||
if (buffer_metrics.line_lengths.size() > 1)
|
||||
return buffer_metrics.line_lengths.last() % m_num_columns;
|
||||
|
||||
return (buffer_metrics.line_lengths.last() + current_prompt_metrics().line_lengths.last()) % m_num_columns;
|
||||
return current_prompt_metrics().offset_with_addition(buffer_metrics, m_num_columns);
|
||||
}
|
||||
|
||||
void set_origin()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue