From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1769 invoked by alias); 19 Sep 2016 07:01:31 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39384 Received: (qmail 19102 invoked from network); 19 Sep 2016 07:01:31 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.26):SA:0(0.0/5.0):. Processed in 0.614448 secs); 19 Sep 2016 07:01:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=mVgTW1hvqeaoTnZlrbzZQ9f+dDo=; b=jO/1/F KlREM96RnuCLDXSInwuYc4KwmwAsGbbnznpRwboO45m7pxTADo+rLKCSVAtNe19C vpNi804vVbD/xheZvJeYLetOCP1j0xZAHrQ9YVXzcAISNrmlvdTEaGPVAE4xQLBn oJ10xqXq7D9rUCfWxr5TaamcXI186giS04AP0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=mVgTW1hvqeaoTnZlrbzZQ9f+dDo=; b=lhwNr EnjUDYUCMPVpnVwAXjmM9WvbKuYUXQF1J8JriY5QgZ7br69jnRrvZjqPTh2kCAxw ad4y7dU442Lde0EW7nu/aE5FIPu2Kxe4c7Ea6BbChqr5GP4Y+vo9ptFwZOBVQDDr NwEeeBTzflE2ygSzFaixBgMwaH/YJSe+SepQzw= X-Sasl-enc: roQjKfMMfGcO+uLUgwrNHRi4Hn4jCuEAkvsRaclODHNZ 1474268480 Date: Mon, 19 Sep 2016 07:00:21 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: Off-by-one with select-*-shell-word text object? Message-ID: <20160919070020.GA3836@fujitsu.shahaf.local2> References: <160916102137.ZM11290@torch.brasslantern.com> <76020.1474058827@hydra.kiddle.eu> <160916142248.ZM26196@torch.brasslantern.com> <10734.1474068633@hydra.kiddle.eu> <160916200205.ZM27241@torch.brasslantern.com> <20160917074259.GA26221@fujitsu.shahaf.local2> <160917072918.ZM29255@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <160917072918.ZM29255@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 > those are the only cases of builtins that want the opposite case (point > to the caller). Testing WIDGET_INT is only necessary because the sense > of setbindk is reversed from the sense of ZLE_VIOPER. > The code tests that ZLE_VIOPER is unset and that WIDGET_INT is set; therefore, any widget implemented in a module will have $WIDGET pointing to itself, unless that widget has ZLE_VIOPER set. 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. 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. > } Whether a widget is implemented in C or in shell has no bearing on > } whether it assumes that $WIDGET points to itself. > > At the moment that's not true; a widget implemented in shell can never > safely assume that $WIDGET points to itself. I am not arguing that widgets implemented in shell should be able to assume that $WIDGET is self-referential. I am arguing that widgets implemented in C should not be able to to assume that. (unless they have that new bitmask flag I'm proposing) Cheers, Daniel