about summary refs log tree commit diff
path: root/Src
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 /Src
parentee2f0dbed113742cd9f6f5574ab2e2d280a0de34 (diff)
downloadzsh-cbc44bd64a39649b7c73123c6eb85559d8d26f6c.tar.gz
zsh-cbc44bd64a39649b7c73123c6eb85559d8d26f6c.tar.xz
zsh-cbc44bd64a39649b7c73123c6eb85559d8d26f6c.zip
38145: ZLE parameters for isearch and completion suffixes
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_params.c60
-rw-r--r--Src/vincent.zsh30
2 files changed, 90 insertions, 0 deletions
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
+}