Kernel/Terminal: Add support for bracketed paste mode
This gets rid of annoying warnings when running some programs like bash
This commit is contained in:
parent
8f6cb9c057
commit
db7ffcf9d5
|
|
@ -417,6 +417,11 @@ namespace Kernel
|
|||
m_cursor_shown = (ch == 'h');
|
||||
return reset_ansi();
|
||||
}
|
||||
if (m_ansi_state.question && m_ansi_state.nums[0] == 2004)
|
||||
{
|
||||
// bracketed paste mode, there is no pasting so this is a no-op
|
||||
return reset_ansi();
|
||||
}
|
||||
reset_ansi();
|
||||
dprintln_if(DEBUG_VTTY, "Unsupported ANSI CSI character {}", static_cast<char>(ch));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -274,7 +274,13 @@ void Terminal::run()
|
|||
|
||||
auto clipboard = clipboard_or_error.release_value();
|
||||
if (!clipboard.empty())
|
||||
{
|
||||
if (m_brackted_paste_mode)
|
||||
write(m_shell_info.pts_master, "\e[200~", 6);
|
||||
write(m_shell_info.pts_master, clipboard.data(), clipboard.size());
|
||||
if (m_brackted_paste_mode)
|
||||
write(m_shell_info.pts_master, "\e[201~", 6);
|
||||
}
|
||||
m_got_key_event = true;
|
||||
|
||||
break;
|
||||
|
|
@ -930,12 +936,26 @@ Rectangle Terminal::handle_csi(char ch)
|
|||
break;
|
||||
case 'h':
|
||||
case 'l':
|
||||
if (!m_csi_info.question || m_csi_info.fields[0] != 25)
|
||||
if (m_csi_info.question)
|
||||
{
|
||||
dprintln("unsupported ANSI CSI {}", ch);
|
||||
switch (m_csi_info.fields[0])
|
||||
{
|
||||
case 25:
|
||||
m_cursor_shown = (ch == 'h');
|
||||
break;
|
||||
case 2004:
|
||||
m_brackted_paste_mode = (ch == 'h');
|
||||
break;
|
||||
default:
|
||||
dwarnln("unsupported ANSI CSI ? {} {}", m_csi_info.fields[0], ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dwarnln("unsupported ANSI CSI {} {}", m_csi_info.fields[0], ch);
|
||||
break;
|
||||
}
|
||||
m_cursor_shown = (ch == 'h');
|
||||
break;
|
||||
case 'n':
|
||||
if (m_csi_info.fields[0] != 6)
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ private:
|
|||
uint32_t m_selection_e_col { UINT32_MAX };
|
||||
uint32_t m_selection_e_row { UINT32_MAX };
|
||||
bool m_selecting { false };
|
||||
bool m_brackted_paste_mode { false };
|
||||
|
||||
bool m_cursor_shown { true };
|
||||
bool m_cursor_blink_shown { true };
|
||||
|
|
|
|||
Loading…
Reference in New Issue