Kernel: Implement ANSI CSI L for TTY

vim seems to be using this, so I decided its needed
This commit is contained in:
Bananymous 2024-08-01 22:08:46 +03:00
parent 840000d02b
commit af78a2d080
1 changed files with 17 additions and 0 deletions

View File

@ -242,6 +242,23 @@ namespace Kernel
else else
dprintln("Unsupported ANSI CSI character K"); dprintln("Unsupported ANSI CSI character K");
return reset_ansi(); return reset_ansi();
case 'L': // Insert Line
if (m_ansi_state.nums[0] == -1)
m_ansi_state.nums[0] = 1;
for (uint32_t y_off = 0; y_off < (uint32_t)m_ansi_state.nums[0]; y_off++)
{
const uint32_t src_y = m_row + y_off;
const uint32_t dst_y = src_y + m_ansi_state.nums[0];
if (dst_y < m_height)
{
memcpy(&m_buffer[dst_y * m_width], &m_buffer[src_y * m_width], m_width * sizeof(Cell));
for (uint32_t x = 0; x < m_width; x++)
render_from_buffer(x, dst_y);
}
for (uint32_t x = 0; x < m_width; x++)
putchar_at(' ', x, src_y);
}
return reset_ansi();
case 'S': // Scroll Up case 'S': // Scroll Up
dprintln("Unsupported ANSI CSI character S"); dprintln("Unsupported ANSI CSI character S");
return reset_ansi(); return reset_ansi();