summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVT/Terminal.h
diff options
context:
space:
mode:
authorryanb-dev <ryanb.404dev@gmail.com>2021-12-28 09:44:30 -0600
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-12-28 20:28:58 +0330
commit979f300337c6411d037511600146303d6eca3ffd (patch)
treecf8ccdf0ca8b2e72e1d089d452dccc1b55fa6233 /Userland/Libraries/LibVT/Terminal.h
parentebaf2112604553c2713dc5f84dd2b1fae54c07e2 (diff)
downloadserenity-979f300337c6411d037511600146303d6eca3ffd.zip
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
Diffstat (limited to 'Userland/Libraries/LibVT/Terminal.h')
-rw-r--r--Userland/Libraries/LibVT/Terminal.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/Userland/Libraries/LibVT/Terminal.h b/Userland/Libraries/LibVT/Terminal.h
index 5313d20715..7146317bc8 100644
--- a/Userland/Libraries/LibVT/Terminal.h
+++ b/Userland/Libraries/LibVT/Terminal.h
@@ -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);