mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:07:45 +00:00
LibVT: Fix out-of bounds line insert
Unless DECOM mode is enabled, the cursor positions are measured from the top left corner of the screen. We counted from the top margin, causing line inserts in `vim` to go out-of-bounds and crash the terminal.
This commit is contained in:
parent
6465f87827
commit
0c6f019285
1 changed files with 2 additions and 2 deletions
|
@ -608,7 +608,7 @@ void Terminal::IL(Parameters params)
|
||||||
count = params[0];
|
count = params[0];
|
||||||
invalidate_cursor();
|
invalidate_cursor();
|
||||||
for (; count > 0; --count) {
|
for (; count > 0; --count) {
|
||||||
active_buffer().insert(cursor_row() + m_scroll_region_top, make<Line>(m_columns));
|
active_buffer().insert(cursor_row(), make<Line>(m_columns));
|
||||||
if (m_scroll_region_bottom + 1 < active_buffer().size())
|
if (m_scroll_region_bottom + 1 < active_buffer().size())
|
||||||
active_buffer().remove(m_scroll_region_bottom + 1);
|
active_buffer().remove(m_scroll_region_bottom + 1);
|
||||||
else
|
else
|
||||||
|
@ -640,7 +640,7 @@ void Terminal::DL(Parameters params)
|
||||||
count = min(count, max_count);
|
count = min(count, max_count);
|
||||||
|
|
||||||
for (int c = count; c > 0; --c) {
|
for (int c = count; c > 0; --c) {
|
||||||
active_buffer().remove(cursor_row() + m_scroll_region_top);
|
active_buffer().remove(cursor_row());
|
||||||
if (m_scroll_region_bottom < active_buffer().size())
|
if (m_scroll_region_bottom < active_buffer().size())
|
||||||
active_buffer().insert(m_scroll_region_bottom, make<Line>(m_columns));
|
active_buffer().insert(m_scroll_region_bottom, make<Line>(m_columns));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue