From a1fb01462d3367d56835df2694ab5ffe2747014a Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 5 Jul 2026 11:08:58 +0900 Subject: [PATCH] Copy input snapshot on bracketed paste begin []rune(t.input) is a same-type conversion that aliases t.input; in-place query edits during the paste corrupt the snapshot and skew the paste-end comparison. --- src/terminal.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/terminal.go b/src/terminal.go index 73fc6da2..d9da03f0 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -6885,7 +6885,9 @@ func (t *Terminal) Loop() error { t.mutex.Unlock() return false case actBracketedPasteBegin: - current := []rune(t.input) + // Clone: []rune(t.input) would alias t.input, and in-place + // query edits during the paste would corrupt the snapshot + current := slices.Clone(t.input) t.pasting = ¤t case actBracketedPasteEnd: if t.pasting != nil {