mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:27:35 +00:00
Kernel+LibVT: Fix selection with scrollback wrap-around
If lines are removed from the tail of the scrollback buffer, the previous line indices will refer to different lines; therefore we need to offset them.
This commit is contained in:
parent
13991eade7
commit
ce9460de59
7 changed files with 23 additions and 10 deletions
|
@ -45,7 +45,7 @@ public:
|
|||
virtual void set_window_title(const StringView&) = 0;
|
||||
virtual void set_window_progress(int value, int max) = 0;
|
||||
virtual void terminal_did_resize(u16 columns, u16 rows) = 0;
|
||||
virtual void terminal_history_changed() = 0;
|
||||
virtual void terminal_history_changed(int delta) = 0;
|
||||
virtual void emit(const u8*, size_t) = 0;
|
||||
virtual void set_cursor_style(CursorStyle) = 0;
|
||||
};
|
||||
|
@ -141,10 +141,11 @@ public:
|
|||
void set_max_history_size(size_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
auto previous_size = m_history.size();
|
||||
m_max_history_lines = 0;
|
||||
m_history_start = 0;
|
||||
m_history.clear();
|
||||
m_client.terminal_history_changed();
|
||||
m_client.terminal_history_changed(-previous_size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -158,7 +159,7 @@ public:
|
|||
}
|
||||
m_history = move(new_history);
|
||||
m_history_start = 0;
|
||||
m_client.terminal_history_changed();
|
||||
m_client.terminal_history_changed(value - existing_line_count);
|
||||
}
|
||||
m_max_history_lines = value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue