summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorm0viefreak <m0viefreak.cm@googlemail.com>2016-03-13 22:51:11 +0100
committerPeter Stephenson <pws@zsh.org>2016-03-21 09:43:29 +0000
commitcbc44bd64a39649b7c73123c6eb85559d8d26f6c (patch)
treee1ac61af4face736858d12d956f2a9f40bc4bf99
parentee2f0dbed113742cd9f6f5574ab2e2d280a0de34 (diff)
downloadzsh-cbc44bd64a39649b7c73123c6eb85559d8d26f6c.tar.gz
zsh-cbc44bd64a39649b7c73123c6eb85559d8d26f6c.zip
38145: ZLE parameters for isearch and completion suffixes
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/zle.yo26
-rw-r--r--Src/Zle/zle_params.c60
-rw-r--r--Src/vincent.zsh30
4 files changed, 121 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0d431456d..6c6e286e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-21 Peter Stephenson <p.stephenson@samsung.com>
+
+ * m0viefreak: 38145: Doc/Zsh/zle.yo, Src/Zle/zle_params.c: Make
+ isearch and completion suffix variables visible as parameters.
+
2016-03-19 Mikael Magnusson <mikachu@gmail.com>
* 38186: Completion/Unix/Command/_adb: fix remote file completion,
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 414c8dd65..161cef77f 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 b5bb288f1..7cbb3df5a 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))
{
diff --git a/Src/vincent.zsh b/Src/vincent.zsh
new file mode 100644
index 000000000..65da7d764
--- /dev/null
+++ b/Src/vincent.zsh
@@ -0,0 +1,30 @@
+updprompt()
+{
+ psvar[2]=""
+
+ unset _trapchld_called
+ local njobs jobstr
+ njobs=$#jobstates
+ [[ $njobs -gt 1 ]] && jobstr="s"
+ [[ $njobs -ge 1 ]] && jobstr=" $njobs job$jobstr |"
+
+ echo 1 > /dev/tty
+
+ [[ -n $TTY && $TERM == (xterm*|dtterm|mlterm|rxvt*|screen*) ]] &&
+ {
+ [[ $TERM == screen* ]] || print -nP "\e]1;%m${ptsn:+[$ptsn]}:%.\x07"
+ print -nP "\e]2;${jobstr}${WINTITLE:+ $WINTITLE |} %n@%m - %~ | %y\x07"
+ } > /dev/tty
+
+ echo 2 > /dev/tty
+}
+
+TRAPCHLD()
+{
+ echo SIGCHLD 1 > /dev/tty
+ if [[ -o interactive && -n $TTY ]] then
+ updprompt
+ typeset -g _trapchld_called=1
+ fi
+ echo SIGCHLD 2 > /dev/tty
+}