mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibVT: Add scrollback history to VT::Terminal
The default (hard-coded) history size is 500 lines. When the history is altered, the TerminalClient is notified via terminal_history_changed().
This commit is contained in:
parent
a5cdd0afa5
commit
462336ed49
2 changed files with 12 additions and 0 deletions
|
@ -666,6 +666,13 @@ void Terminal::scroll_up()
|
|||
{
|
||||
// NOTE: We have to invalidate the cursor first.
|
||||
invalidate_cursor();
|
||||
if (m_scroll_region_top == 0) {
|
||||
auto line = move(m_lines.ptr_at(m_scroll_region_top));
|
||||
m_history.append(move(line));
|
||||
while (m_history.size() > max_history_size())
|
||||
m_history.take_first();
|
||||
m_client.terminal_history_changed();
|
||||
}
|
||||
m_lines.remove(m_scroll_region_top);
|
||||
m_lines.insert(m_scroll_region_bottom, make<Line>(m_columns));
|
||||
m_need_full_flush = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue