Terminal: Add ANSI CSI P and ANSI SGR 22

This commit is contained in:
Bananymous 2025-06-05 02:41:48 +03:00
parent a912a4dc67
commit 49f203d61d
1 changed files with 21 additions and 0 deletions

View File

@ -350,6 +350,9 @@ void Terminal::handle_sgr(int32_t value)
case 10:
// default font
break;
case 22:
m_is_bold = false;
break;
case 27:
m_colors_inverted = false;
break;
@ -569,6 +572,24 @@ Rectangle Terminal::handle_csi(char ch)
break;
}
case 'P':
{
const uint32_t count = (m_csi_info.fields[0] == -1) ? 1 : m_csi_info.fields[0];
const uint32_t dst_x = m_cursor.x * m_font.width();
const uint32_t src_x = (m_cursor.x + count) * m_font.width();
const uint32_t y = m_cursor.y * m_font.height();
texture.copy_rect(dst_x, y, src_x, y, m_window->width() - src_x, m_font.height());
texture.fill_rect(m_window->width() - count * m_font.width(), y, count * m_font.width(), m_font.height(), m_bg_color);
should_invalidate = {
dst_x,
y,
m_window->width() - dst_x,
m_font.height()
};
break;
}
case '@':
{
const uint32_t count = (m_csi_info.fields[0] == -1) ? 1 : m_csi_info.fields[0];