Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Expose isearch and suffix regions to widgets.
- X-seq: zsh-workers 38145
- From: m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Expose isearch and suffix regions to widgets.
- Date: Sun, 13 Mar 2016 22:51:11 +0100
- Cc: m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=PIG/OEo3APgCam2gWMT58rUTSOim6IFDBZ+ltly+QWc=; b=hgmJdzcoxoK9TGTQW+NjUHgfkI1xzwLjb/XXQyhb05ugGgwrWdHoHKXvCDErskf5e9 BCrlJt5hYecOCj8SOhy1Bx1+RNzC+sx35SC/TYJ4xjY48Zgsf1BfEjgGqf0PlaFjNwRF pnpmgiieOtkVDKhp3S94AocvrFjMZIh4QFkNGPioph+GF1t9kSWCmSiCwutsrehnaVKi MMMwzOI/+YQKSB9NKx4z1inxWr/f2TLsAFT6e1U3DMAa0dso3gWM0i6zo/HlKy6f5gLe 3MDEYNckMaJSXDkCZf2qysBKUkdU04ZhuR1dm7pCtODP79MDIJXYHRWTRITh0ZIAqSOq RFzw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This does the same as
36445: Expose yankb, yanke, ZLE_YANK to widgets.
did, but for isearch and suffix regions.
---
Doc/Zsh/zle.yo | 26 +++++++++++++++++++++++
Src/Zle/zle_params.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+)
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 414c8dd..161cef7 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -835,6 +835,19 @@ 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.
+
+All parameters are read-only.
+)
vindex(KEYMAP)
item(tt(KEYMAP) (scalar))(
The name of the currently selected keymap; read-only.
@@ -977,6 +990,19 @@ and tt(zle_highlight); see
ifzman(the section CHARACTER HIGHLIGHTING below)\
ifnzman(noderef(Character Highlighting)) for details.
)
+vindex(SUFFIX_ACTIVE)
+vindex(SUFFIX_START)
+vindex(SUFFIX_END)
+xitem(tt(SUFFIX_ACTIVE) (integer))
+xitem(tt(SUFFIX_START) (integer))
+item(tt(SUFFIX_END) (integer))(
+tt(SUFFIX_ACTIVE) indicates whether an auto-removable completion suffix
+is currently active. tt(SUFFIX_START) and tt(SUFFIX_END) give the
+location of the suffix and are in the same units as tt(CURSOR). They are
+only valid for reading when tt(SUFFIX_ACTIVE) is non-zero.
+
+All parameters are read-only.
+)
vindex(UNDO_CHANGE_NO)
item(tt(UNDO_CHANGE_NO) (integer))(
A number representing the state of the undo history. The only use
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index b5bb288..7cbb3df 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -103,6 +103,18 @@ 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 suffixstart_gsu =
+{ get_suffixstart, NULL, zleunsetfn };
+static const struct gsu_integer suffixend_gsu =
+{ get_suffixend, NULL, zleunsetfn };
+static const struct gsu_integer suffixactive_gsu =
+{ get_suffixactive, NULL, zleunsetfn };
static const struct gsu_array killring_gsu =
{ get_killring, set_killring, unset_killring };
@@ -152,6 +164,12 @@ 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 },
+ { "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 },
{ "ZLE_STATE", PM_SCALAR | PM_READONLY, GSU(zle_state_gsu), NULL },
{ NULL, 0, NULL, NULL }
};
@@ -521,6 +539,48 @@ set_yankend(UNUSED(Param pm), zlong i)
}
/**/
+static zlong
+get_isearchstart(UNUSED(Param pm))
+{
+ return isearch_startpos;
+}
+
+/**/
+static zlong
+get_isearchend(UNUSED(Param pm))
+{
+ return isearch_endpos;
+}
+
+/**/
+static zlong
+get_isearchactive(UNUSED(Param pm))
+{
+ return isearch_active;
+}
+
+/**/
+static zlong
+get_suffixstart(UNUSED(Param pm))
+{
+ return zlecs - suffixlen;
+}
+
+/**/
+static zlong
+get_suffixend(UNUSED(Param pm))
+{
+ return zlecs;
+}
+
+/**/
+static zlong
+get_suffixactive(UNUSED(Param pm))
+{
+ return suffixlen;
+}
+
+/**/
static char *
get_cutbuffer(UNUSED(Param pm))
{
--
2.5.0.234.gefc8a62
Messages sorted by:
Reverse Date,
Date,
Thread,
Author