UI: ANSI colors, more explicit erase check
This commit is contained in:
@@ -615,17 +615,22 @@ void log_frame::UpdateUI()
|
|||||||
buf_line.assign(std::string_view(m_tty_buf).substr(str_index, m_tty_buf.find_first_of('\n', str_index) - str_index));
|
buf_line.assign(std::string_view(m_tty_buf).substr(str_index, m_tty_buf.find_first_of('\n', str_index) - str_index));
|
||||||
str_index += buf_line.size() + 1;
|
str_index += buf_line.size() + 1;
|
||||||
|
|
||||||
buf_line.erase(std::remove_if(buf_line.begin(), buf_line.end(), [this](s8 c)
|
// If ANSI TTY is enabled, remove all control characters except for ESC (0x1B) for ANSI sequences
|
||||||
|
if (m_ansi_tty)
|
||||||
{
|
{
|
||||||
// If ANSI TTY is enabled, preserve ESC (0x1B) for ANSI sequences
|
buf_line.erase(std::remove_if(buf_line.begin(), buf_line.end(), [](s8 c)
|
||||||
if (m_ansi_tty)
|
|
||||||
{
|
{
|
||||||
return c <= 0x8 || c == 0x7F || (c >= 0xE && c <= 0x1F && c != 0x1B);
|
return c <= 0x8 || c == 0x7F || (c >= 0xE && c <= 0x1F && c != 0x1B);
|
||||||
}
|
}), buf_line.end());
|
||||||
|
}
|
||||||
// Remove all control characters so output is clean
|
// Otherwise, remove all control characters to keep the output clean
|
||||||
return c <= 0x8 || c == 0x7F || (c >= 0xE && c <= 0x1F);
|
else
|
||||||
}), buf_line.end());
|
{
|
||||||
|
buf_line.erase(std::remove_if(buf_line.begin(), buf_line.end(), [](s8 c)
|
||||||
|
{
|
||||||
|
return c <= 0x8 || c == 0x7F || (c >= 0xE && c <= 0x1F);
|
||||||
|
}), buf_line.end());
|
||||||
|
}
|
||||||
|
|
||||||
// save old scroll bar state
|
// save old scroll bar state
|
||||||
QScrollBar* sb = m_tty->verticalScrollBar();
|
QScrollBar* sb = m_tty->verticalScrollBar();
|
||||||
|
|||||||
Reference in New Issue
Block a user