From 2a5302a1cf0e10ac76d7761178231b59a1d083ef Mon Sep 17 00:00:00 2001 From: Giuseppe Lumia Date: Wed, 8 May 2024 00:26:07 +0200 Subject: [PATCH] Fix paste of text with line feed characters (#3043) Some terminals may send line feed characters when pasting text with newlines. --- readline/readline.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readline/readline.go b/readline/readline.go index 8ba7d89c..6fa45391 100644 --- a/readline/readline.go +++ b/readline/readline.go @@ -218,7 +218,7 @@ func (i *Instance) Readline() (string, error) { case CharCtrlZ: fd := int(syscall.Stdin) return handleCharCtrlZ(fd, i.Terminal.termios) - case CharEnter: + case CharEnter, CharCtrlJ: output := buf.String() if output != "" { i.History.Add([]rune(output)) @@ -232,7 +232,7 @@ func (i *Instance) Readline() (string, error) { metaDel = false continue } - if r >= CharSpace || r == CharEnter { + if r >= CharSpace || r == CharEnter || r == CharCtrlJ { buf.Add(r) } }