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

Re: PATCH: Add $OVERSTRIKE in zle widgets



Peter Stephenson wrote:
> On Tue,  3 Aug 2010 02:57:33 +0200
> Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
>> This adds a read-only integer parameter `$OVERSTRIKE' to the set of
>> special parameters available in zle-widgets. Since `zle-keymap-select'
>> is a widget, it has access to the parameter. That makes it trivial to
>> set $psvar[1] to "r" if zle is in overstrike mode.
>> 
>> 
>> Do others think that's useful enough to have in zsh?
>
> One think I'd suggest is using OVERWRITE instead of OVERSTRIKE, since
> that's what the corresponding zle widget is called; there's no use of
> "overstrike" in the documentation at present, and it vaguely suggests to me
> a visual effect such as two characters on top of one another or a line
> through.  You might also want to refer to the overwrite-mode widget.

Okay, will change that.


> Apart from that, this looks useful; the only thing that might make a
> difference is if there was some other information that could be combined
> with this and the result presented in a more compact way, such as a set of
> flags in a single variable.  However, I can't think of anything that would
> fit that bill, and the code is minimal anyway.

One thing, that may make sense would be to signal whether or nor a
mini-buffer is active or not. When switching to a mini-buffer (with
`execute-named-cmd' for example) the $KEYMAP in `zle-keymap-select()'
is "viins". But - the way I understand it - there are really only a few
key bindings are available in a mini-buffer. So, it would make sense to
be able to display that state accordingly.

I didn't look into where to get that information from yet.

How would you organise that information? In a string, where multiple
characters would signify different states? Like ZLE_STATE='mo' meaning
overwrite mode and a mini-buffer is active.

Or would you be using an associative array where we'd set key value
pairs like zle_state[overwrite]=1 and zle_state[mini-buffer]=1?

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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