Kenrel: TTY fix cursor position with ANSI escapes

This commit is contained in:
Bananymous 2023-01-13 14:19:15 +02:00
parent 57cbd728db
commit af8d486893
1 changed files with 10 additions and 2 deletions

View File

@ -212,6 +212,10 @@ void TTY::HandleAnsiEscape(uint16_t ch)
dprintln("Unsupported ANSI CSI character J"); dprintln("Unsupported ANSI CSI character J");
return ResetAnsiEscape(); return ResetAnsiEscape();
case 'K': // Erase in Line case 'K': // Erase in Line
if (m_ansi_state.nums[0] == -1 || m_ansi_state.nums[0] == 0)
for (uint32_t i = m_column; i < m_width; i++)
PutCharAt(' ', i, m_row);
else
dprintln("Unsupported ANSI CSI character K"); dprintln("Unsupported ANSI CSI character K");
return ResetAnsiEscape(); return ResetAnsiEscape();
case 'S': // Scroll Up case 'S': // Scroll Up
@ -262,7 +266,11 @@ void TTY::PutChar(char ch)
return; return;
if (m_ansi_state.mode != 0) if (m_ansi_state.mode != 0)
return HandleAnsiEscape(cp); {
HandleAnsiEscape(cp);
SetCursorPosition(m_column, m_row);
return;
}
// https://en.wikipedia.org/wiki/ANSI_escape_code // https://en.wikipedia.org/wiki/ANSI_escape_code
switch (cp) switch (cp)