mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 18:25:07 +00:00
LibLine: Be less lazy when moving prompt origin row
Fixes the issue where adding multiple lines in one refresh cycle would break cursor positioning.
This commit is contained in:
parent
27a5c51f3f
commit
5e6b9cbc91
1 changed files with 7 additions and 7 deletions
|
@ -1036,13 +1036,6 @@ void Editor::refresh_display()
|
|||
}
|
||||
m_was_resized = false;
|
||||
}
|
||||
// Do not call hook on pure cursor movement.
|
||||
if (m_cached_prompt_valid && !m_refresh_needed && m_pending_chars.size() == 0) {
|
||||
// Probably just moving around.
|
||||
reposition_cursor();
|
||||
m_cached_buffer_metrics = actual_rendered_string_metrics(buffer_view());
|
||||
return;
|
||||
}
|
||||
// We might be at the last line, and have more than one line;
|
||||
// Refreshing the display will cause the terminal to scroll,
|
||||
// so note that fact and bring origin up.
|
||||
|
@ -1053,6 +1046,13 @@ void Editor::refresh_display()
|
|||
else
|
||||
m_origin_row = m_num_lines - current_num_lines + 1;
|
||||
}
|
||||
// Do not call hook on pure cursor movement.
|
||||
if (m_cached_prompt_valid && !m_refresh_needed && m_pending_chars.size() == 0) {
|
||||
// Probably just moving around.
|
||||
reposition_cursor();
|
||||
m_cached_buffer_metrics = actual_rendered_string_metrics(buffer_view());
|
||||
return;
|
||||
}
|
||||
|
||||
if (on_display_refresh)
|
||||
on_display_refresh(*this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue