From fbaea583a5406a09312f3af7f49b1903468ab9be Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 10 Oct 2025 20:52:04 +0200 Subject: [PATCH] When pasting multi-line text into a prompt, don't treat the line feeds as "confirm" This is likely to do bad things; for example, if the prompt is the shell command prompt, then we would run into what looks like a deadlock bug in tcell. In other cases, the characters in the following lines might be treated as random commands after the prompt is confirmed. --- pkg/gui/controllers/helpers/confirmation_helper.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index f8e25c47c..4a746819b 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -26,6 +26,14 @@ func NewConfirmationHelper(c *HelperCommon) *ConfirmationHelper { func (self *ConfirmationHelper) wrappedConfirmationFunction(cancel goContext.CancelFunc, function func() error) func() error { return func() error { + if self.c.GocuiGui().IsPasting { + // The user is pasting multi-line text into a prompt; we don't want to handle the + // line feeds as "confirm" keybindings. Simply ignoring them is the best we can do; this + // will cause the entire pasted text to appear as a single line in the prompt. Hopefully + // the user knows that ctrl-u allows them to delete it again... + return nil + } + cancel() self.c.Context().Pop()