Skip to content

Commit fbaea58

Browse files
committed
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.
1 parent 6b5b493 commit fbaea58

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/gui/controllers/helpers/confirmation_helper.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ func NewConfirmationHelper(c *HelperCommon) *ConfirmationHelper {
2626

2727
func (self *ConfirmationHelper) wrappedConfirmationFunction(cancel goContext.CancelFunc, function func() error) func() error {
2828
return func() error {
29+
if self.c.GocuiGui().IsPasting {
30+
// The user is pasting multi-line text into a prompt; we don't want to handle the
31+
// line feeds as "confirm" keybindings. Simply ignoring them is the best we can do; this
32+
// will cause the entire pasted text to appear as a single line in the prompt. Hopefully
33+
// the user knows that ctrl-u allows them to delete it again...
34+
return nil
35+
}
36+
2937
cancel()
3038

3139
self.c.Context().Pop()

0 commit comments

Comments
 (0)