From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1568 invoked from network); 4 May 2008 13:28:19 -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=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 13:28:19 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 35522 invoked from network); 4 May 2008 13:28:14 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 May 2008 13:28:14 -0000 Received: (qmail 13613 invoked by alias); 4 May 2008 13:28:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24911 Received: (qmail 13595 invoked from network); 4 May 2008 13:28:11 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 May 2008 13:28:11 -0000 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.238]) by bifrost.dotsrc.org (Postfix) with ESMTP id DCA3780ED172 for ; Sun, 4 May 2008 15:28:06 +0200 (CEST) Received: by rv-out-0506.google.com with SMTP id g37so1195838rvb.21 for ; Sun, 04 May 2008 06:28:05 -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=+ZtXwoEGr7zU92e4lM+NZRpJVeSV7POU15Dt59YOzcg=; b=MVyZPzaYV1rClOZDPOLyfpVaSyG8ldN8sb577/QL2VQEHLkF8BgQU7QgRnrfhYE3jMijQFJ/lUj0qVQQtJ4R9pifm4lrTfHLmjBoJERyJH72Av1pWeynMrWvAG7bGt5gx7AY/fOH1qFOUIkBIXh1/y4nkAI872yTi3eDgjDNYDA= 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=Cgbcr/onRmx8HJ9tAmt4PK6MUJJ8D322d3GlSTZn3zARBIEtWJjOzA7Drb/GpXBMhrqw91/567RqJYe667r3bxDT7NL5OrIe3OfNVvAme74CyGYIHRlAcgP8ijKCH/bSdNj6g139Tjn6WzAs15mNreeH83F5IdWxD1eKdvfF6W8= Received: by 10.141.153.17 with SMTP id f17mr2293085rvo.267.1209907685377; Sun, 04 May 2008 06:28:05 -0700 (PDT) Received: by 10.140.127.7 with HTTP; Sun, 4 May 2008 06:28:05 -0700 (PDT) Message-ID: <237967ef0805040628s6fea0226ie8bc02607e4583e0@mail.gmail.com> Date: Sun, 4 May 2008 15:28:05 +0200 From: "Mikael Magnusson" To: zsh-workers@sunsite.dk Subject: Re: Identify "active" region? In-Reply-To: <237967ef0805040535y2f4343eds5b42adf9bc3075a6@mail.gmail.com> 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> <237967ef0805040533x699fcf37p2ea24d2abe38d3df@mail.gmail.com> <237967ef0805040535y2f4343eds5b42adf9bc3075a6@mail.gmail.com> X-Virus-Scanned: ClamAV 0.91.2/7020/Sun May 4 14:41:48 2008 on bifrost X-Virus-Status: Clean 2008/5/4 Mikael Magnusson : > 2008/5/4 Mikael Magnusson : > > > 2008/5/4 Peter Stephenson : > > > > 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: > > > > + { "REGION", PM_INTEGER, GSU(region_gsu), NULL}, > > I realize two things just after hitting send, 1) the variable should > probably be called something like REGIONACTIVE, and 2) I didn't write > any documentation for it. diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index f8435c1..e07c955 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -774,6 +774,11 @@ The part of the buffer that lies to the right of the cursor position. If it is assigned to, only that part of the buffer is replaced, and the cursor remains between the old tt($LBUFFER) and the new tt($RBUFFER). ) +vindex(REGIONACTIVE) +item(tt(REGIONACTIVE) (integer))( +Indicates if the region is currently active. It can be assigned 0 or 1 +to deactivate and deactivate the region respectively. +) vindex(region_highlight) item(tt(region_highlight) (array))( Each element of this array may be set to a string that describes diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c index a04ee72..a114596 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 }, + { "REGIONACTIVE", 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