From 22899d3788d5eb8bad9440f2f0886170bb7ca61d Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 6 Oct 2010 08:25:28 +0000 Subject: 28285: zle-isearch-update and zle-isearch-exit --- ChangeLog | 7 ++++++- Doc/Zsh/zle.yo | 22 ++++++++++++++++++++++ Src/Zle/zle_hist.c | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ac14165bb..66b3fa65c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-10-06 Peter Stephenson + + * 28285: Doc/Zsh/zle.yo, Src/Zle/zle_hist.c: add + zle-isearch-update and zle-isearch-exit hooks. + 2010-10-02 Peter Stephenson * 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); -- cgit 1.4.1