From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9555 invoked by alias); 16 Sep 2016 20:52:57 -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: 39365 Received: (qmail 29839 invoked from network); 16 Sep 2016 20:52:57 -0000 X-Qmail-Scanner-Diagnostics: from nm27-vm7.bullet.mail.ir2.yahoo.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(212.82.97.58):SA:0(0.0/5.0):. Processed in 0.392824 secs); 16 Sep 2016 20:52:57 -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=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.mail.yahoo.com designates 212.82.97.58 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1474058828; bh=b9KIG+1c5STyUvo6ovoud9vySsCm+J1bqICj5p6yW9g=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=sY4R6GK3uOAH7vEGtS3nTn9kv/unSomfZcnd3hQxR3XcvgM3E24MVxPxu08OCFeIM1jW2Wx1yP+SSykgbFb8tVRHykvmqcIPMnPDeyialj6XVeVSwZcLMPEwGBD5AXipVJUhV2Sb8M9yA/f6MQrj/X84O9ZzSr72VjyZtM3gCOa7nT6Fghm7S0rW7IkamDiJIM5yMT9vC9F+iHpAKFHcQgv1J9PU9WM58VkoTHE0/xlfPLX4tlgEryOwYCrVaf3ETOPmP6kfO9YNq59NtX1PxBqFbMr+2/xLAMfFf6cL2SEpNkHQueN1dCMRALYuqyazoZKmIYIbAItYN+aBH1Hq0A== X-Yahoo-Newman-Id: 26663.84063.bm@smtp125.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: VoSkX.QVM1mX8ioVH3SE0nQb3g1dwQKP3eQbjhxQXbXKvle aGEDUYAhOKGrbZx933ZPlxyO4fsyHAW5BwYFnZripXT3vde2LP3C9umDyKQb MgBLtQMOYQQLyGkBzkcVI7beRz4eK3FtG9aKcL1cqY6KceEKq5eXAGN.WkYZ oS35d3QEHpW6Eq0_rGtpp3lcXvy0nFfz8aFqSAo9l_bcLz6BlrUIo0GuFy1O HkVR_uWu2hu90YwutuBO5iGQN8FKs2f5JIlaf9oDf0Re17qIq5iuwLA47mCL OVeF6LUyo0FW37_2LeE6T09bJYCelSx9eSvxzToRb5mNFUwCTou2VFL7o3fi 7_e4sQ2rPU27JOeyGu74VAPOnnq8x74lQnCFHEktq1DArZxdiEQKiNl2h5.q 00FKZu4K8_5iJMGG_Nle5Lgr3q9eUVKLJ.job0wZ9jJXwwEKW0l9o9oTwF6A C0ToUUl9EzO6l6dx9nu.dvvrt2AWql2Y7ryatgx9v1JDNgtXwd7U3FTnWz28 L64FqGNzIWswKygITz4E44EoK40Vab3Acl9LxeGTS91U- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <160916102137.ZM11290@torch.brasslantern.com> From: Oliver Kiddle References: <160916102137.ZM11290@torch.brasslantern.com> To: zsh-workers@zsh.org Subject: Re: Off-by-one with select-*-shell-word text object? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <76019.1474058827.1@hydra.kiddle.eu> Date: Fri, 16 Sep 2016 22:47:07 +0200 Message-ID: <76020.1474058827@hydra.kiddle.eu> Bart wrote: > Noticed during recent zsh-users thread: > > torch% quote-this-word() { zle select-in-shell-word; zle quote-region } > torch% zle -N quote-this-word > torch% bindkey "''" quote-this-word > torch% echo foo'' > torch% echo' foo' > > Note the left-quote has now included the space preceding the word. I at > first suspected another vi-mode vs. emacs-mode difference, but: > > torch% bindkey -v "''" quote-this-word You'd need to do vicmd bindings to identify a vi-mode vs. emacs-mode difference: bindkey -a. However, it is neither that nor an off-by-one error. The problem is that both select-in-shell-word and select-a-shell-word are handled by a single function that tests the value of bindk to see which widget it is running. bindk apparently points to the quote-this-word shell widget so that isn't doing what was intended. In this case you're getting select-a-shell-word behaviour as a result. For select-a-shell-word including the preceding space is intentional. Looking at execzlefunc, I can't see an alternative way to get the actual widget being run. Have I missed anything? I could add another global variable for that. Or a ZLE_ flag - actually two to cover select-in-word/select-in-blank-word. Or it needs six small wrapper functions for the actual widgets. Have you got any preference in the choice between those or alternative ideas? Oliver