zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayne@opencoder.net>
To: Zsh list <zsh-workers@zsh.org>
Subject: A weird smart-insert-last-word bug
Date: Fri, 2 Nov 2018 17:03:34 -0700	[thread overview]
Message-ID: <CAHSx_SuJv+dsGYbS2YO0ZUdmO6YGtVXjWHgFNhbnStwKk8mHCQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]

Here's something I've seen very sporadically but I couldn't work out a test
case before today.
I make use of smart-insert-last-word like this:

zlewidget '' insert-last-word smart-insert-last-word
zstyle :insert-last-word match '[^,]??*'
zstyle :insert-last-word auto-previous 1

Every now and then it destroys some part of the command line when starting
a new insert sequence.  This seems to be caused by its simple conditional
at the start of its file being inadequate to know when it is really
continuing:

if (( HISTNO == _ilw_hist && cursor == _ilw_cursor &&
UNDO_CHANGE_NO == _ilw_changeno ))

Since I have hist_ignore_space set, this makes it possible to trigger the
bug on successive command lines when typing a series of commands that begin
with a space.  Imagine that the underscore char is a leading space:

echo foo
echo bar
_echo <Esc>.
_echo <Esc>.<Esc>.
testing12<Esc>.

at that point the command buffer will be "testinfoo".  Note that it took 2
space-starting commands to be able to trigger the bug on a successive
command-line and that the column has to line up with the column where it
left off on the prior line.

The bug can also happen during an edit on a single line if you initiate the
function a second time from the column where it left off, even though some
editing has happened in between. For example:

echo <Esc>.<Bksp><Bksp><Bksp>bug<Esc>.

..wayne..

             reply	other threads:[~2018-11-03  0:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03  0:03 Wayne Davison [this message]
2018-11-03  0:37 ` Bart Schaefer
2018-11-08  1:58   ` Wayne Davison

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=CAHSx_SuJv+dsGYbS2YO0ZUdmO6YGtVXjWHgFNhbnStwKk8mHCQ@mail.gmail.com \
    --to=wayne@opencoder.net \
    --cc=zsh-workers@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).