From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24498 invoked by alias); 7 Nov 2014 10:42:33 -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: 33631 Received: (qmail 12736 invoked from network); 7 Nov 2014 10:42:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Sgjsc7nAlUZbKcvtF/00bhHdAJyUnFPaFknblPALPzc=; b=ImpNiX/LnsEAhJjNGq8UYgT0zl4uEDF02Tzyj1sxy0M6crWtQqiD4WXPB6FilwvT42 Q4Tor6XppJqGcKmG6BDzHnWWI/D15tgntB2r6PeELsTckg8f2oPHGn4CgQuPV6sQVMIj GTqNp+zfJxkYs9YcrApN0DC0VJzqQ1uOnUNm5o+Lkm9J47n7V7mwnwk3zKoAODi9+YYa opvM1IoLdaNh+ihhDa/xp4H76lR5GFvQ2uOJuopFAcmnzACw24c6In87Gpn9/jnfDaQP mOUsvwVk1CgAhVCEpSddLV1DzHrwipHWDYymEb3+f3tdoWS+EGUF3b7FbXeZs2BbhmPa cVig== MIME-Version: 1.0 X-Received: by 10.107.165.19 with SMTP id o19mr11776385ioe.1.1415356949612; Fri, 07 Nov 2014 02:42:29 -0800 (PST) In-Reply-To: <10571.1415355346@thecus.kiddle.eu> References: <8414.1415317703@thecus.kiddle.eu> <1415351070-22018-1-git-send-email-mikachu@gmail.com> <10571.1415355346@thecus.kiddle.eu> Date: Fri, 7 Nov 2014 11:42:29 +0100 Message-ID: Subject: Re: PATCH: Add an option to disable deactivating region hilighting whenever you edit something From: Mikael Magnusson To: Oliver Kiddle Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Fri, Nov 7, 2014 at 11:15 AM, Oliver Kiddle wrote: > Mikael Magnusson wrote: >> >> While we're on the topic of deactivating the region, I've had this >> patch lying around forever in my local tree, but never cared enough to >> send it. It just keeps the region on until the user disables it again, I >> use this very complicated widget: > > I'm concerned that, as is often the case with options, it is a somewhat > blunt instrument. It isn't just edits that this affects. Most vi > commands too: I'd want the option set for vi command mode but not for > vi insert mode. That said, the use case you show is quite nice. The > region should be more flexible (and I have some stuff coming in this > area which I probably now need to start unloading). Yeah, I've never used vi mode and I honestly didn't look into all the cases this code is called from at all, it just fixed my case and didn't do anything I didn't want. (This may also have been a reason for not sending it, git send-mail apparently stripped the fact that the patch is from 2011, so I forgot exactly what I checked or not). > Currently, the region is fixed to an emacs region model so > 'region_active = 0' typically appears in shared code. We need control to > move up to individual widgets somewhat more. > > I can think of a few ways this might be more versatile, setting a > flag on the zle widget so you might mark self-insert as being region > preserving might be one option. I've pondered adding this for completion > suffix removal too. We also have some prefix widgets such as for numeric > arguments which affect the behaviour of the following widget. > > If we do go with the option, I'll have a think about the name. I'll also admit I'm not that good at naming options :). I would be all for more versatility as well. If we want to be super consistent and stuff, we have the auto-suffix-remove and auto-suffix-retain widgets already. Would that model work for this also? I suppose it would be a bit inconvenient making a wrapper function for every single widget you want to define this for, and/or change ones you already have wrappers for, though. Maybe? You can get away with just defining one wrapper function for each and naming the widgets with a suffix that you strip in the function, and then calling zle .$widgetstripped so it's not that bad maybe. -- Mikael Magnusson