Zsh Mailing List Archive
Messages sorted by:
Re: Off-by-one with select-*-shell-word text object?
Daniel Shahaf wrote:
> Bart Schaefer wrote on Sat, Sep 17, 2016 at 07:29:18 -0700:
> > On Sep 17, 7:42am, Daniel Shahaf wrote:
> > }
> > } I think it would be cleaner to invent a new bitmask flag and set it on
> > } the affected widgets (select-*-word, run-help, etc) than to overload
> > } WIDGET_INT for this purpose.
> > It's not overloading WIDGET_INT, it's overloading ZLE_VIOPER - because
Or arguably it is bindk that is overloaded from when $WIDGET was
added as a shell interface. I'd consider redundancy in the flags
to be worse than overloading.
> As Oliver said, aside from the vi operator widgets, only 4 builtin
> widgets care about whether $WIDGET points to themselves or not. There
> is no reason, AIUI, to force set_bindk to 1 for the other 390 builtin
> widgets, as well as for all future widgets implemented in modules.
You've got to force set_bindk to either 1 or 0 and my guess is that
a future widget is more likely to want 1 than to want 0. Even with
a new bitmask flag, I'd sooner opt for it having the opposite sense
to what you suggest.
> That's why I suggested to invent a new bitmask flag that implies
> set_bindk on a per-widget basis: the property 'requires $WIDGET to be
> self-referential' does not follow from 'is implemented in C'. I can
> also imagine future user-defined widgets that need $WIDGET to always
> point to themselves.
We've already got a wealth of ZLE_ flags and setting them for a new
widget can be error prone. Nobody ever noticed that run-help,
which-command and zap-to-char wouldn't work from a shell widget so
picking up on errors is not necessarily easy.
[aside: if anyone relied on it for run-help/which-command to invoke
their own command, they should use zle -A].
getvirange() is more concerned with the keys that were used than
with the identify of the widget. That's why I'd sooner regard it
as bindk that is overloaded. But I don't think adding another
variable like $WIDGET is a good idea. Would just complicate the
interface and it isn't really needed.
Messages sorted by: