From: Peter Stephenson <Peter.Stephenson@csr.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Add a hook on isearch
Date: Thu, 23 Sep 2010 10:40:23 +0100 [thread overview]
Message-ID: <20100923104023.5e44028e@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <AANLkTinEDT7WjY3JFUuMXiN7mHLCYo5OJfsgs2jGW1Sd@mail.gmail.com>
On Sat, 18 Sep 2010 18:50:42 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:
> commit 8ab10e2394da712db896662316fb4df304c212ef
> Author: Mikael Magnusson <mikachu@gmail.com>
> Date: Sat Sep 18 18:46:38 2010 +0200
>
> Add zle-isearch-update
I tried this and it seemed to work... There may be things you shouldn't be
doing at that point but I'm not sure what they are.
The exit hook needed to be after setting statusline to NULL. Apart from
that, I'm not sure what the best place is.
Index: Doc/Zsh/zle.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v
retrieving revision 1.88
diff -p -u -r1.88 zle.yo
--- Doc/Zsh/zle.yo 8 Sep 2010 12:32:32 -0000 1.88
+++ Doc/Zsh/zle.yo 23 Sep 2010 09:32:30 -0000
@@ -887,6 +887,28 @@ If they do not exist, no special action
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
Index: Src/Zle/zle_hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v
retrieving revision 1.65
diff -p -u -r1.65 zle_hist.c
--- Src/Zle/zle_hist.c 27 Apr 2010 08:58:35 -0000 1.65
+++ Src/Zle/zle_hist.c 23 Sep 2010 09:32:31 -0000
@@ -1472,6 +1472,7 @@ doisearch(char **args, int dir, int patt
} 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 patt
}
statusline = NULL;
unmetafy_line();
+ zlecallhook("zle-isearch-exit", NULL);
if (exitfn)
exitfn(zlenoargs);
selectkeymap(okeymap, 1);
--
Peter Stephenson <pws@csr.com> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
prev parent reply other threads:[~2010-09-23 10:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-18 16:50 Mikael Magnusson
2010-09-18 20:00 ` Bart Schaefer
2010-09-19 14:54 ` Mikael Magnusson
2010-09-20 9:02 ` Peter Stephenson
2010-09-23 9:40 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100923104023.5e44028e@pwslap01u.europe.root.pri \
--to=peter.stephenson@csr.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).