summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2023-03-14 04:48:11 +1100
committerMaxime Coste <mawww@kakoune.org>2023-03-14 04:48:11 +1100
commit1322abef646533eb67d8c76d8a459ef48becb266 (patch)
treed2430e9f12ade34f420cba5fe3624fdb7cfbab83
parentcb3512f01e7243919241eed80d975e1f08a0903d (diff)
Convert \r to \n in bracketed pastes
It seems many terminals emits \r for newlines in bracketed pastes, manually convert this.
-rw-r--r--src/terminal_ui.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/terminal_ui.cc b/src/terminal_ui.cc
index 13a8af4b..d411dd67 100644
--- a/src/terminal_ui.cc
+++ b/src/terminal_ui.cc
@@ -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);