diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/zle_hist.c | 10 | ||||
-rw-r--r-- | Src/Zle/zle_params.c | 12 |
2 files changed, 20 insertions, 2 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c index 54da51710..1c17defc7 100644 --- a/Src/Zle/zle_hist.c +++ b/Src/Zle/zle_hist.c @@ -41,6 +41,14 @@ int lastcol; /**/ 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 @@ doisearch(char **args, int dir) 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))) diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c index 1987974d2..c8b518cbf 100644 --- a/Src/Zle/zle_params.c +++ b/Src/Zle/zle_params.c @@ -89,6 +89,8 @@ static struct zleparam { 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 } }; @@ -526,3 +528,13 @@ free_prepostdisplay(void) 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 ""; +} |