Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Identify "active" region?
- X-seq: zsh-workers 24909
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Identify "active" region?
- Date: Sun, 4 May 2008 14:33:09 +0200
- 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=
- In-reply-to: <20080504132102.076669ed@pws-pc>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <080503175219.ZM11801@xxxxxxxxxxxxxxxxxxxxxx> <20080504132102.076669ed@pws-pc>
2008/5/4 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>:
> On Sat, 03 May 2008 17:52:19 -0700
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author