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

Re: zle: vi mode: wrong undo handling on fresh lines



Bart wrote:
> On Jan 29, 12:00am, Oliver Kiddle wrote:
> } depends on the cursor position. If the cursor starts at the
> } beginning of the line then 'i' makes more sense.

It occurs to me that for a blank line 'o' is just as valid as either 'i'
or 'a' but possibly more useful.

> } > Is it OK to assume we're not in insert mode when vi-repeat is executed?
 
> Actually it does more than beep; with --

Having played with this in various combinations, I think we should just
start virepeatchange() with:
    if (!invicmdmode())
	return 1;
Unless someone can be bothered to make it do something useful.

> 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?

Logically, reading it from within zle-keymap-select would do that except
UNDO_CHANGE_NO doesn't seem to be set in there. That would provide a
roundabout way to get at the contents of viinsbegin from a widget.

> 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.)

That does skip the code I added and some other vi-change related code
but I'm somewhat inclined to think it should stay that way to allow more
control from a zle widget. It would seem odd for zle -K to have extra
side-effects. The cursor repositioning is probably necessary, however.

Oliver



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