about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-10-06 08:25:28 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-10-06 08:25:28 +0000
commit22899d3788d5eb8bad9440f2f0886170bb7ca61d (patch)
tree6247f83aaefc37ce18334221b1f5e4e037948cce
parentaf7d4869e6a04ad48550d5dcd8a7bdd6193f5d9b (diff)
downloadzsh-22899d3788d5eb8bad9440f2f0886170bb7ca61d.tar.gz
zsh-22899d3788d5eb8bad9440f2f0886170bb7ca61d.tar.xz
zsh-22899d3788d5eb8bad9440f2f0886170bb7ca61d.zip
28285: zle-isearch-update and zle-isearch-exit
-rw-r--r--ChangeLog7
-rw-r--r--Doc/Zsh/zle.yo22
-rw-r--r--Src/Zle/zle_hist.c2
3 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ac14165bb..66b3fa65c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-06  Peter Stephenson  <pws@csr.com>
+
+	* 28285: Doc/Zsh/zle.yo, Src/Zle/zle_hist.c: add
+	zle-isearch-update and zle-isearch-exit hooks.
+
 2010-10-02  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* unposted: NEWS: note HIST_LEX_WORDS option.
@@ -13695,5 +13700,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5093 $
+* $Revision: 1.5094 $
 *****************************************************
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 87933b93d..92b5f20a1 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -887,6 +887,28 @@ If they do not exist, no special action is taken.  The environment
 provided is identical to that for any other editing widget.
 
 startitem()
+tindex(zle-isearch-exit)
+item(tt(zle-isearch-exit))(
+Executed at the end of incremental search at the point where the isearch
+prompt is removed from the display.  See tt(zle-isearch-update) for
+an example.
+)
+tindex(zle-isearch-update)
+item(tt(zle-isearch-update))(
+Executed within incremental search when the display is about to be
+redrawn.  Additional output below the incremental search prompt can be
+generated by using `tt(zle -M)' within the widget.  For example,
+
+example(zle-isearch-update+LPAR()RPAR() { zle -M "Line $HISTNO"; }
+zle -N zle-isearch-update)
+
+Note the line output by `tt(zle -M)' is not deleted on exit from
+incremental search.  This can be done from a tt(zle-isearch-exit)
+widget:
+
+example(zle-isearch-exit+LPAR()RPAR() { zle -M ""; }
+zle -N zle-isearch-exit)
+)
 tindex(zle-line-init)
 item(tt(zle-line-init))(
 Executed every time the line editor is started to read a new line
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index d9586b832..412644827 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1472,6 +1472,7 @@ doisearch(char **args, int dir, int pattern)
 	} else
 	    isearch_active = 0;
     ref:
+	zlecallhook("zle-isearch-update", NULL);
 	zrefresh();
 	if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak)) {
 	    int i;
@@ -1670,6 +1671,7 @@ doisearch(char **args, int dir, int pattern)
     }
     statusline = NULL;
     unmetafy_line();
+    zlecallhook("zle-isearch-exit", NULL);
     if (exitfn)
 	exitfn(zlenoargs);
     selectkeymap(okeymap, 1);