zsh-users
 help / color / mirror / code / Atom feed
From: Moritz Bunkus <moritz@bunkus.org>
To: zsh-users@zsh.org
Subject: bug in replace-string: widget loses characters
Date: Mon, 8 Oct 2012 20:19:10 +0200	[thread overview]
Message-ID: <CANPayMTaAjtWV6=CE1rAuMhbZX=igKtBwNBLysPBq-W+G_GJYQ@mail.gmail.com> (raw)

Hey,

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,
mosu


             reply	other threads:[~2012-10-08 18:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08 18:19 Moritz Bunkus [this message]
2012-10-09 11:22 ` Peter Stephenson
2012-10-09 11:54   ` Moritz Bunkus
2012-10-09 14:34   ` Peter Stephenson
2012-10-09 15:24     ` Bart Schaefer
2012-10-09 15:44       ` Peter Stephenson
2012-10-09 16:11         ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANPayMTaAjtWV6=CE1rAuMhbZX=igKtBwNBLysPBq-W+G_GJYQ@mail.gmail.com' \
    --to=moritz@bunkus.org \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).