Index: Doc/Zsh/zle.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v retrieving revision 1.26 diff -u -r1.26 zle.yo --- Doc/Zsh/zle.yo 5 Aug 2002 12:33:28 -0000 1.26 +++ Doc/Zsh/zle.yo 3 Dec 2002 19:41:30 -0000 @@ -627,6 +627,11 @@ any extra are ignored. If fewer than eight elements are given, the remaining elements of the kill ring will be treated as undefined. ) + +vindex(LASTSEARCH) +item(tt(LASTSEARCH) (scalar))( +The last search string used by an interactive search ; read-only. +) vindex(LASTWIDGET) item(tt(LASTWIDGET) (scalar))( The name of the last widget that was executed; read-only. Index: Src/Zle/zle_hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v retrieving revision 1.8 diff -u -r1.8 zle_hist.c --- Src/Zle/zle_hist.c 24 Jun 2002 18:21:20 -0000 1.8 +++ Src/Zle/zle_hist.c 3 Dec 2002 19:41:35 -0000 @@ -41,6 +41,14 @@ /**/ int histline; +/* Previous search string use in an incremental search */ + +/**/ +char *previous_search = NULL; + +/**/ +int previous_search_len = 0; + #define ZLETEXT(X) ((X)->zle_text ? (X)->zle_text : (X)->text) /**/ @@ -757,8 +765,6 @@ int hl = histline, savekeys = -1, feep = 0; Thingy cmd; char *okeymap; - static char *previous_search = NULL; - static int previous_search_len = 0; Histent he; if (!(he = quietgethist(hl))) Index: Src/Zle/zle_params.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_params.c,v retrieving revision 1.6 diff -u -r1.6 zle_params.c --- Src/Zle/zle_params.c 4 Jul 2002 10:13:38 -0000 1.6 +++ Src/Zle/zle_params.c 3 Dec 2002 19:41:37 -0000 @@ -89,6 +89,8 @@ zleunsetfn, NULL }, { "POSTDISPLAY", PM_SCALAR, FN(set_postdisplay), FN(get_postdisplay), zleunsetfn, NULL }, + { "LASTSEARCH", PM_SCALAR | PM_READONLY, NULL, FN(get_lsearch), + zleunsetfn, NULL }, { NULL, 0, NULL, NULL, NULL, NULL } }; @@ -525,4 +527,14 @@ set_prepost(&predisplay, &predisplaylen, NULL); if (postdisplaylen) set_prepost(&postdisplay, &postdisplaylen, NULL); +} + +/**/ +static char * +get_lsearch(Param pm) +{ + if (previous_search_len) + return metafy(previous_search, previous_search_len, META_HEAPDUP); + else + return ""; }