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

replace-regex widget not replacing semicolons


I'm using replace-regex bound to ALT+r, and it usually works quite
well. Today I noticed that it doesn't replace semicolons, though. It
looks like an off-by-one error when removing the char from the buffer.
For example, when I enter

$ asd ; qwe

and replace ; by any single char (e.g. "+") then the line stays
exactly as it is.

However, if I try to replace it by two or more chars (e.g. "&&") then
one of the replaced chars is missing and the semicolon stays in its
place, like this:

$ asd &; qwe

How to reproduce:

chai-latte$ zsh --norcs
chai-latte% autoload regexp-replace
chai-latte% autoload replace-string
chai-latte% zle -N replace-regex replace-string
chai-latte% bindkey "^[r" replace-regex
chai-latte% asd ; qwe

Now hit ALT+r, enter ; and &&, see the output changed to:

chai-latte% asd &; qwe

Kind regards,

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