Convert \r to \n in bracketed pastes

It seems many terminals emits \r for newlines in bracketed pastes,
manually convert this.
This commit is contained in:
Maxime Coste 2023-03-14 04:48:11 +11:00
parent cb3512f01e
commit 1322abef64

View File

@ -971,7 +971,15 @@ Optional<Key> TerminalUI::get_next_key()
if (m_paste_buffer)
{
m_paste_buffer->push_back(*c);
auto paste_convert = [](char c) {
switch (c)
{
case '\r': return '\n';
default: return c;
}
};
m_paste_buffer->push_back(paste_convert(*c));
return Key{Key::Invalid};
}
return parse_key(*c);