mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-22 04:42:37 +03:00
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.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user