Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Regression in bracketed-paste-magic (not in 5.2, but affects 5.3's test releases)

Commit 20948d0 (38579: Functions/Zle/bracketed-paste-magic: simplify saving and
restoring of state) introduced a regression that results in the ZLE buffer
being repeated when pasting under certain conditions. It was introduced after
5.2 and currently affects 5.2-test-1, 5.2-test-2 and master.

Here's a simple reproducer:

1. Set up environment (.zshrc and history) and open a new session with that

       cd "$(mktemp -d /tmp/XXXXXXX)"
       cat >.zshrc <<'EOF'
       autoload -Uz bracketed-paste-magic
       zle -N bracketed-paste bracketed-paste-magic
       cat >history <<'EOF'
       echo 1
       echo 2
       HOME=$PWD zsh

2. Press the following sequence of keys (no space): ^R echo ^R ^E
   (history-incremental-search-backward, "echo",
   history-incremental-search-backward, end-of-line), then paste something,
   say, "zsh".

At this point, we should expect

    echo 1zsh

in the ZLE buffer. Instead, we see

    echo 1zshecho 1

note the buffer prior to pasting being repeated at the end.

Here's a terminal recording that demonstrates the wrong behavior in action:


Messages sorted by: Reverse Date, Date, Thread, Author