zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: Off-by-one with select-*-shell-word text object?
Date: Mon, 19 Sep 2016 12:01:54 +0200	[thread overview]
Message-ID: <47450.1474279314@hydra.kiddle.eu> (raw)
In-Reply-To: <20160919070020.GA3836@fujitsu.shahaf.local2>

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.

Oliver


  reply	other threads:[~2016-09-19 10:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16 17:21 Bart Schaefer
2016-09-16 20:47 ` Oliver Kiddle
2016-09-16 21:22   ` Bart Schaefer
2016-09-16 23:30     ` Oliver Kiddle
2016-09-17  3:02       ` Bart Schaefer
2016-09-17  7:42         ` Daniel Shahaf
2016-09-17 14:29           ` Bart Schaefer
2016-09-19  7:00             ` Daniel Shahaf
2016-09-19 10:01               ` Oliver Kiddle [this message]
2016-09-19 15:19                 ` 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=47450.1474279314@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --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).