Allow multi-line bracketed paste to not create single line with LF entry

This commit is contained in:
Laurent Demailly
2025-07-11 16:57:45 -07:00
parent 30da5dd58f
commit 76633e06ae

View File

@@ -146,6 +146,7 @@ const (
keyCtrlD = 4
keyCtrlU = 21
keyEnter = '\r'
keyLF = '\n' // technically not a key (unless a user uses Ctrl+J), but needed for bracketed paste mode with `\n`s.
keyEscape = 27
keyBackspace = 127
keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota
@@ -567,7 +568,7 @@ func (t *Terminal) handleKey(key rune) (line string, ok bool) {
t.setLine(runes, len(runes))
}
}
case keyEnter:
case keyEnter, keyLF:
t.moveCursorToPos(len(t.line))
t.queue([]rune("\r\n"))
line = string(t.line)