From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: zle: vi mode: wrong undo handling on fresh lines
Date: Tue, 28 Jan 2014 18:59:46 -0800 [thread overview]
Message-ID: <140128185946.ZM21512@torch.brasslantern.com> (raw)
In-Reply-To: <2700.1390950035@thecus.kiddle.eu>
On Jan 29, 12:00am, Oliver Kiddle wrote:
} Subject: Re: zle: vi mode: wrong undo handling on fresh lines
}
} A non-blank starting line is possible with at least
} accept-line-and-down-history and vi-push-input. In such cases, it
} depends on the cursor position. If the cursor starts at the
} beginning of the line then 'i' makes more sense.
}
} > Is it OK to assume we're not in insert mode when vi-repeat is executed?
}
} Yes. Of course someone can bind a key to the widget but that currently
} just beeps which is fine.
Actually it does more than beep; with --
bindkey -M viins '#' vi-repeat-change
bindkey -v
-- type (whitespace added for clarity)
xxx ESC a yyy #
and you end up with xxxyyya because # has repeated the "a" keystroke.
The yyy hasn't yet been added to the change buffer, so that doesn't get
repeated. If you keep trying to use # from insert-mode (prior to the
patch in 32308), eventually it'll insert a "#", repeat carriage-return
and accept the buffer, probably resulting in a command-not-found.
} How about the following approach to the undo problem:
} The variable undoing was serving as a flag to indicate whether each
} change should be added as an undo event. In vi-mode this would be
} skipped so that the whole vi change became a single undo change. What
} this does is remove that handling and instead merge all the undo events
} corresponding to the vi change in the vi-cmd-mode widget.
This sounds fine to me, and wouldn't have been possible prior to the
numbering of undo events. Is there a well-defined place where a user
defined widget could read $UNDO_CHANGE_NO and be sure it was the same
as the internal vistartchange value?
} Are there other ways to get into vi command mode besides vi-cmd-mode
} that might get around this?
One doc example for zle-line-init still implies you can get into vi
command mode by "zle -K vicmd". (This even moves one character left
when switching from viins to vicmd; I'm not sure how/where the code
that does that is being called.)
next prev parent reply other threads:[~2014-01-29 3:00 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-22 12:37 Hauke Petersen
2013-09-22 18:24 ` Bart Schaefer
2013-09-22 20:27 ` Hauke Petersen
2013-09-23 4:57 ` Bart Schaefer
2013-09-23 20:30 ` Peter Stephenson
2014-01-24 23:19 ` Oliver Kiddle
2014-01-25 19:15 ` Bart Schaefer
2014-01-27 12:43 ` Peter Stephenson
2014-01-27 16:11 ` Peter Stephenson
2014-01-28 14:58 ` Peter Stephenson
2014-01-28 16:28 ` Bart Schaefer
2014-01-28 16:47 ` Peter Stephenson
2014-01-28 17:41 ` Bart Schaefer
2014-01-28 23:00 ` Oliver Kiddle
2014-01-29 2:59 ` Bart Schaefer [this message]
2014-01-29 10:50 ` Oliver Kiddle
2014-01-29 14:48 ` Bart Schaefer
2014-01-30 14:51 ` Jun T.
2014-01-30 15:38 ` Peter Stephenson
2014-01-30 16:03 ` Bart Schaefer
2014-01-31 12:00 ` Jun T.
2014-01-31 15:19 ` Bart Schaefer
2014-01-31 15:33 ` Peter Stephenson
[not found] ` <16181.1391175951@thecus.kiddle.eu>
2014-01-31 16:43 ` Jun T.
2014-01-31 21:37 ` Oliver Kiddle
2014-01-31 22:32 ` Oliver Kiddle
2014-02-01 19:27 ` Bart Schaefer
2014-02-03 16:20 ` Jun T.
2014-02-03 21:29 ` Oliver Kiddle
2014-02-03 22:20 ` Bart Schaefer
2014-02-03 23:26 ` Oliver Kiddle
2014-02-04 17:11 ` Jun T.
2014-02-05 22:00 ` Oliver Kiddle
2014-02-02 22:10 ` Oliver Kiddle
2014-02-07 14:43 ` Oliver Kiddle
2014-02-07 16:22 ` Bart Schaefer
2014-01-27 16:29 ` Bart Schaefer
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=140128185946.ZM21512@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--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).