From fd9f49292d1c31dfe35d077e4c14cde2021505c8 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 3 Jul 2026 08:58:06 +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 24ebbda7..ac0898e1 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -6851,7 +6851,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 {