From 36f521af58e78053ba3baa06099079f125bddbdd Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 3 Jul 2026 00:54:44 +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 8cd82141..a355ab4f 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -6847,7 +6847,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 {