mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
LibVT: Reset scrollbar after switching to/from the alternate buffer
We did not call the history change callback after switching to the alternate screen buffer, which caused the scrollbar to not change its maximum value. If we already had lines in the scrollback buffer, this meant that we could drag the scrollbar, which then tried to access non-existent lines from the scrollback. Fixes #8581
This commit is contained in:
parent
5e1e67277b
commit
05c174b45a
1 changed files with 4 additions and 0 deletions
|
@ -126,9 +126,11 @@ void Terminal::alter_private_mode(bool should_set, Parameters params)
|
||||||
dbgln_if(TERMINAL_DEBUG, "Switching to Alternate Screen Buffer");
|
dbgln_if(TERMINAL_DEBUG, "Switching to Alternate Screen Buffer");
|
||||||
m_use_alternate_screen_buffer = true;
|
m_use_alternate_screen_buffer = true;
|
||||||
clear();
|
clear();
|
||||||
|
m_client.terminal_history_changed(-m_history.size());
|
||||||
} else {
|
} else {
|
||||||
dbgln_if(TERMINAL_DEBUG, "Switching to Normal Screen Buffer");
|
dbgln_if(TERMINAL_DEBUG, "Switching to Normal Screen Buffer");
|
||||||
m_use_alternate_screen_buffer = false;
|
m_use_alternate_screen_buffer = false;
|
||||||
|
m_client.terminal_history_changed(m_history.size());
|
||||||
}
|
}
|
||||||
m_need_full_flush = true;
|
m_need_full_flush = true;
|
||||||
#else
|
#else
|
||||||
|
@ -148,11 +150,13 @@ void Terminal::alter_private_mode(bool should_set, Parameters params)
|
||||||
m_normal_saved_state = m_current_state;
|
m_normal_saved_state = m_current_state;
|
||||||
m_use_alternate_screen_buffer = true;
|
m_use_alternate_screen_buffer = true;
|
||||||
clear();
|
clear();
|
||||||
|
m_client.terminal_history_changed(-m_history.size());
|
||||||
} else {
|
} else {
|
||||||
dbgln_if(TERMINAL_DEBUG, "Switching to Normal Screen Buffer and restoring state");
|
dbgln_if(TERMINAL_DEBUG, "Switching to Normal Screen Buffer and restoring state");
|
||||||
m_current_state = m_normal_saved_state;
|
m_current_state = m_normal_saved_state;
|
||||||
m_use_alternate_screen_buffer = false;
|
m_use_alternate_screen_buffer = false;
|
||||||
set_cursor(cursor_row(), cursor_column());
|
set_cursor(cursor_row(), cursor_column());
|
||||||
|
m_client.terminal_history_changed(m_history.size());
|
||||||
}
|
}
|
||||||
m_need_full_flush = true;
|
m_need_full_flush = true;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue