Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Expose isearch and suffix regions to widgets.




On 11.04.2016 16:25, Bart Schaefer wrote:
> On Apr 11,  6:16am, Daniel Shahaf wrote:
> } Subject: Re: [PATCH] Expose isearch and suffix regions to widgets.
> }
> } m0viefreak wrote on Sun, Apr 10, 2016 at 15:10:39 +0200:
> } > ISEARCH_ACTIVE does not describe the fact that the minibuffer is active,
> } > but the fact that a pattern that was typed in there does actually
> } > matches the BUFFER.
> } 
> } Rename the shell parameter, then?
> 
> ISEARCH_MATCH ?  (I wonder if, like $MATCH, it could contain the actual
> matched string, instead of merely being a boolean.)


I think ISEARCH_MATCH would be the ideal name, if the matched string was
exposed, but I haven't found a simple way to do that.

On the other hand, I would also like to keep the _ACTIVE part at the
end, to keep all four of those special parameters named similarly:

{YANK,SUFFIX,REGION,ISEARCH}_ACTIVE

What do you think of ISEARCHMATCH_{ACTIVE,START,END}?

That would still reflect that it's merely a boolean flag, while still
keeping the semantic that it describes the match.

>From 94705d5f45981552bdf3241dc4b2aaa59a560d94 Mon Sep 17 00:00:00 2001
From: m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>
Date: Sun, 10 Apr 2016 14:57:51 +0200
Subject: [PATCH] Change names of ISEARCH_* parameters to ISEARCHMATCH_*

---
 Doc/Zsh/zle.yo       | 21 +++++++++++----------
 Src/Zle/zle_params.c | 24 ++++++++++++------------
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 161cef7..80d3f39 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -835,16 +835,17 @@ which always gives the number of the history line being added to the main
 shell's history.  tt(HISTNO) refers to the line being retrieved within
 zle.
 )
-vindex(ISEARCH_ACTIVE)
-vindex(ISEARCH_START)
-vindex(ISEARCH_END)
-xitem(tt(ISEARCH_ACTIVE) (integer))
-xitem(tt(ISEARCH_START) (integer))
-item(tt(ISEARCH_END) (integer))(
-tt(ISEARCH_ACTIVE) indicates whether an incremental search minibuffer
-is active. tt(ISEARCH_START) and tt(ISEARCH_END) give the location of
-the matched pattern and are in the same units as tt(CURSOR). They are
-only valid for reading when tt(ISEARCH_ACTIVE) is non-zero.
+vindex(ISEARCHMATCH_ACTIVE)
+vindex(ISEARCHMATCH_START)
+vindex(ISEARCHMATCH_END)
+xitem(tt(ISEARCHMATCH_ACTIVE) (integer))
+xitem(tt(ISEARCHMATCH_START) (integer))
+item(tt(ISEARCHMATCH_END) (integer))(
+tt(ISEARCHMATCH_ACTIVE) indicates whether a part of the tt(BUFFER) is
+currently matched by an incremental search pattern. tt(ISEARCHMATCH_START)
+and tt(ISEARCHMATCH_END) give the location of the matched part and are
+in the same units as tt(CURSOR). They are only valid for reading
+when tt(ISEARCHMATCH_ACTIVE) is non-zero.
 
 All parameters are read-only.
 )
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 7cbb3df..c6387bf 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -103,12 +103,12 @@ static const struct gsu_integer yankend_gsu =
 { get_yankend, set_yankend, zleunsetfn };
 static const struct gsu_integer yankactive_gsu =
 { get_yankactive, NULL, zleunsetfn };
-static const struct gsu_integer isearchstart_gsu =
-{ get_isearchstart, NULL, zleunsetfn };
-static const struct gsu_integer isearchend_gsu =
-{ get_isearchend, NULL, zleunsetfn };
-static const struct gsu_integer isearchactive_gsu =
-{ get_isearchactive, NULL, zleunsetfn };
+static const struct gsu_integer isearchmatchstart_gsu =
+{ get_isearchmatchstart, NULL, zleunsetfn };
+static const struct gsu_integer isearchmatchend_gsu =
+{ get_isearchmatchend, NULL, zleunsetfn };
+static const struct gsu_integer isearchmatchactive_gsu =
+{ get_isearchmatchactive, NULL, zleunsetfn };
 static const struct gsu_integer suffixstart_gsu =
 { get_suffixstart, NULL, zleunsetfn };
 static const struct gsu_integer suffixend_gsu =
@@ -164,9 +164,9 @@ static struct zleparam {
     { "YANK_START", PM_INTEGER, GSU(yankstart_gsu), NULL },
     { "YANK_END", PM_INTEGER, GSU(yankend_gsu), NULL },
     { "YANK_ACTIVE", PM_INTEGER | PM_READONLY, GSU(yankactive_gsu), NULL },
-    { "ISEARCH_START", PM_INTEGER, GSU(isearchstart_gsu), NULL },
-    { "ISEARCH_END", PM_INTEGER, GSU(isearchend_gsu), NULL },
-    { "ISEARCH_ACTIVE", PM_INTEGER | PM_READONLY, GSU(isearchactive_gsu), NULL },
+    { "ISEARCHMATCH_START", PM_INTEGER, GSU(isearchmatchstart_gsu), NULL },
+    { "ISEARCHMATCH_END", PM_INTEGER, GSU(isearchmatchend_gsu), NULL },
+    { "ISEARCHMATCH_ACTIVE", PM_INTEGER | PM_READONLY, GSU(isearchmatchactive_gsu), NULL },
     { "SUFFIX_START", PM_INTEGER, GSU(suffixstart_gsu), NULL },
     { "SUFFIX_END", PM_INTEGER, GSU(suffixend_gsu), NULL },
     { "SUFFIX_ACTIVE", PM_INTEGER | PM_READONLY, GSU(suffixactive_gsu), NULL },
@@ -540,21 +540,21 @@ set_yankend(UNUSED(Param pm), zlong i)
 
 /**/
 static zlong
-get_isearchstart(UNUSED(Param pm))
+get_isearchmatchstart(UNUSED(Param pm))
 {
     return isearch_startpos;
 }
 
 /**/
 static zlong
-get_isearchend(UNUSED(Param pm))
+get_isearchmatchend(UNUSED(Param pm))
 {
     return isearch_endpos;
 }
 
 /**/
 static zlong
-get_isearchactive(UNUSED(Param pm))
+get_isearchmatchactive(UNUSED(Param pm))
 {
     return isearch_active;
 }
-- 
2.8.0



Messages sorted by: Reverse Date, Date, Thread, Author