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

bug in replace-string: widget loses characters


zsh 5.0.0 on Arch Linux here. I'm using the replace-string widget and
have the problem that often it loses characters from the current input
when I use it. Not always, but often enough.

In order to demonstrate what I mean, do the following:

* Start zsh with --no-rcs:

sweet-chili% zsh --no-rcs
sweet-chili% zsh --version
zsh 5.0.0 (x86_64-unknown-linux-gnu)

* load the widget and bind it to a key, e.g. Alt-R:

sweet-chili% autoload replace-string
sweet-chili% zle -N replace-regex replace-string
sweet-chili% bindkey '^[r' replace-regex

* Next enter some text with several arguments, don't hit enter. In
this example I've used the following:

sweet-chili% somecmd 64/ubuntu/precise 64/ubuntu/quantal argab

* Hit Alt-R. Replace 64 with 32, and the result will be:

sweet-chili% somecmd 32/ubuntu/precise 32/ubuntu/quantal arga

Note that the "b" is missing at the end. Undo will not restore that
character, but it will turn the "32"s into "64"s again.

* It gets even weirder. Now hit "enter". The command will not be
found, obviously. Go one up in the history displaying the command
again and prefix it with "echo ". The result should look like this:

sweet-chili% echo somecmd 32/ubuntu/precise 32/ubuntu/quantal arga

* Hit Alt-R and replace 32 with 64 again. This time the space between
'echo' and 'somecmd' will be removed resulting in:

sweet-chili% echosomecmd 64/ubuntu/precise 64/ubuntu/quantal arga

Unlike after the first replacement the cursor will be after the "echo"
and not at the end of the line.

This unpredictable behavior makes using the widgets pretty pointless
(or at least highly frustrating), and I do think it qualifies to be
called a bug, doesn't it? ;)

Kind regards,

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