zsh-workers
 help / color / mirror / code / Atom feed
From: m0viefreak <m0viefreak.cm@googlemail.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] Expose isearch and suffix regions to widgets.
Date: Sat, 16 Apr 2016 18:17:40 +0200	[thread overview]
Message-ID: <571265A4.9040000@googlemail.com> (raw)
In-Reply-To: <160411072508.ZM24168@torch.brasslantern.com>

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]



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.


[-- Attachment #2: 0001-Change-names-of-ISEARCH_-parameters-to-ISEARCHMATCH_.patch --]
[-- Type: text/plain, Size: 4140 bytes --]

>From 94705d5f45981552bdf3241dc4b2aaa59a560d94 Mon Sep 17 00:00:00 2001
From: m0viefreak <m0viefreak.cm@googlemail.com>
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


  reply	other threads:[~2016-04-16 16:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-13 21:51 m0viefreak
2016-03-21  9:47 ` Peter Stephenson
2016-03-21 16:11   ` Daniel Shahaf
2016-04-10  5:26 ` Bart Schaefer
2016-04-10  5:35   ` Bart Schaefer
2016-04-10 13:10     ` m0viefreak
2016-04-11  6:16       ` Daniel Shahaf
2016-04-11 14:25         ` Bart Schaefer
2016-04-16 16:17           ` m0viefreak [this message]
2016-04-23 21:36             ` Daniel Shahaf
2016-04-23 22:33               ` Bart Schaefer
2016-04-25  8:19                 ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571265A4.9040000@googlemail.com \
    --to=m0viefreak.cm@googlemail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).