From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5630 invoked from network); 4 May 2008 12:33:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 May 2008 12:33:23 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 19823 invoked from network); 4 May 2008 12:33:19 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 May 2008 12:33:19 -0000 Received: (qmail 9996 invoked by alias); 4 May 2008 12:33:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24909 Received: (qmail 9980 invoked from network); 4 May 2008 12:33:16 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 May 2008 12:33:16 -0000 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.235]) by bifrost.dotsrc.org (Postfix) with ESMTP id A600380ED173 for ; Sun, 4 May 2008 14:33:12 +0200 (CEST) Received: by rv-out-0506.google.com with SMTP id g37so1185523rvb.21 for ; Sun, 04 May 2008 05:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=DN2cMnZDH6AfgkGP7SK5WbKoHPMpzUZ4J16BIPpAAhE=; b=di43H7OVFmPTYquaKWI9vc6byp90gUI8y0t+yU7UOA33l32TzUPDMu9qCYBM2ox3sGI6fcNrFL2Iz/rGaNqGI/9cvyEEiNYPjeYUQn54SpyDltQSC8TZrWqdl+9eKkWbopCqpradfgzVGU4CmlNFX/DbbeP3vwh5qTVeDWu11So= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=C5tYhejUcGFB7Qu5BSYwu19wNU30bv92dPOIhBt/TdRw8sI8UWB4Bc0zkdV8LoJD9LcBUNUTJwPDUqyMASiTseQAuVdSDQWfwNJOoxOGF+VoWF++sjriZiAOJLnQZndx+2814zpLiWjVlkCDZyebyDDyASH/Zw7Kqd98xl0sB7k= Received: by 10.140.251.1 with SMTP id y1mr2284973rvh.149.1209904389877; Sun, 04 May 2008 05:33:09 -0700 (PDT) Received: by 10.140.127.7 with HTTP; Sun, 4 May 2008 05:33:09 -0700 (PDT) Message-ID: <237967ef0805040533x699fcf37p2ea24d2abe38d3df@mail.gmail.com> Date: Sun, 4 May 2008 14:33:09 +0200 From: "Mikael Magnusson" To: zsh-workers@sunsite.dk Subject: Re: Identify "active" region? In-Reply-To: <20080504132102.076669ed@pws-pc> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <080503175219.ZM11801@torch.brasslantern.com> <20080504132102.076669ed@pws-pc> X-Virus-Scanned: ClamAV 0.91.2/7019/Sun May 4 04:17:43 2008 on bifrost X-Virus-Status: Clean 2008/5/4 Peter Stephenson : > On Sat, 03 May 2008 17:52:19 -0700 > Bart Schaefer wrote: > > There doesn't seem to be any way to determine that there's an active > > region except to override set-mark-command and exchange-point-and-mark > > to stash something in a global variable. Have I missed something? > > No, that's worth adding. I'll do it if no one gets to it first. It > should be trivial: a new ZLE variable tied into the integer controlling > this. There's no reason it shouldn't be writable, either. This seems to do the trick: diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c index a04ee72..5b8cc30 100644 --- a/Src/Zle/zle_params.c +++ b/Src/Zle/zle_params.c @@ -89,6 +89,8 @@ static const struct gsu_integer numeric_gsu = { get_numeric, set_numeric, unset_numeric }; static const struct gsu_integer pending_gsu = { get_pending, NULL, zleunsetfn }; +static const struct gsu_integer region_gsu = +{ get_region_active, set_region_active, zleunsetfn }; static const struct gsu_array killring_gsu = { get_killring, set_killring, unset_killring }; @@ -125,7 +127,8 @@ static struct zleparam { { "POSTDISPLAY", PM_SCALAR, GSU(postdisplay_gsu), NULL }, { "PREBUFFER", PM_SCALAR | PM_READONLY, GSU(prebuffer_gsu), NULL }, { "PREDISPLAY", PM_SCALAR, GSU(predisplay_gsu), NULL }, - { "RBUFFER", PM_SCALAR, GSU(rbuffer_gsu), NULL }, + { "RBUFFER", PM_SCALAR, GSU(rbuffer_gsu), NULL }, + { "REGION", PM_INTEGER, GSU(region_gsu), NULL}, { "region_highlight", PM_ARRAY, GSU(region_highlight_gsu), NULL }, { "WIDGET", PM_SCALAR | PM_READONLY, GSU(widget_gsu), NULL }, { "WIDGETFUNC", PM_SCALAR | PM_READONLY, GSU(widgetfunc_gsu), NULL }, @@ -252,6 +255,20 @@ get_mark(UNUSED(Param pm)) /**/ static void +set_region_active(UNUSED(Param pm), zlong x) +{ + region_active = !!x; +} + +/**/ +static zlong +get_region_active(UNUSED(Param pm)) +{ + return region_active; +} + +/**/ +static void set_lbuffer(UNUSED(Param pm), char *x) { ZLE_STRING_T y; -- Mikael Magnusson