LibVT: Handle window resize after history overflow
Addresses an issue in which a window resize event after history overflow would cause the Terminal to crash due to a failed assertion. The problematic assertion was removed and the logic updated to support inserting lines even when the start of the history is at an offset (due to an overflow). Resolves #10987
This commit is contained in:
parent
ebaf211260
commit
979f300337
Notes:
sideshowbarker
2024-07-17 22:03:10 +09:00
Author: https://github.com/ryanb-dev Commit: https://github.com/SerenityOS/serenity/commit/979f300337c Pull-request: https://github.com/SerenityOS/serenity/pull/11465 Issue: https://github.com/SerenityOS/serenity/issues/10987
1 changed files with 7 additions and 2 deletions
|
@ -388,9 +388,14 @@ protected:
|
|||
if (max_history_size() == 0)
|
||||
return;
|
||||
|
||||
// If m_history can expand, add the new line to the end of the list.
|
||||
// If there is an overflow wrap, the end is at the index before the start.
|
||||
if (m_history.size() < max_history_size()) {
|
||||
VERIFY(m_history_start == 0);
|
||||
m_history.append(move(line));
|
||||
if (m_history_start == 0)
|
||||
m_history.append(move(line));
|
||||
else
|
||||
m_history.insert(m_history_start - 1, move(line));
|
||||
|
||||
return;
|
||||
}
|
||||
m_history.ptr_at(m_history_start) = move(line);
|
||||
|
|
Loading…
Add table
Reference in a new issue