about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-07-29 14:21:57 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-07-29 14:21:57 +0000
commitefe2876d927b5d028031a6023b622be44c5d5b8a (patch)
treeb2bf41f0a9d4d29850b748948d04706dbde8b566 /Src
parente1d8ca1d70053e44c3e4950ceafe3f07e6e67d0d (diff)
downloadzsh-efe2876d927b5d028031a6023b622be44c5d5b8a.tar.gz
zsh-efe2876d927b5d028031a6023b622be44c5d5b8a.tar.xz
zsh-efe2876d927b5d028031a6023b622be44c5d5b8a.zip
20219: make zle parameter HISTNO writeable
add history-pattern-search widget
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_hist.c2
-rw-r--r--Src/Zle/zle_params.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 70d8699c0..c6fb7acdb 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -715,6 +715,8 @@ void
 free_isrch_spots(void)
 {
     zfree(isrch_spots, max_spot * sizeof(*isrch_spots));
+    max_spot = 0;
+    isrch_spots = NULL;
 }
 
 /**/
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index f2eaea723..f0f1cde95 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -75,7 +75,7 @@ static struct zleparam {
         zleunsetfn, NULL },
     { "NUMERIC", PM_INTEGER | PM_UNSET, FN(set_numeric), FN(get_numeric),
         unset_numeric, NULL },
-    { "HISTNO", PM_INTEGER | PM_READONLY, NULL, FN(get_histno),
+    { "HISTNO", PM_INTEGER, FN(set_histno), FN(get_histno),
         zleunsetfn, NULL },
     { "BUFFERLINES", PM_INTEGER | PM_READONLY, NULL, FN(get_bufferlines),
         zleunsetfn, NULL },
@@ -326,6 +326,17 @@ unset_numeric(Param pm, int exp)
 }
 
 /**/
+static void
+set_histno(UNUSED(Param pm), zlong x)
+{
+    Histent he;
+
+    if (!(he = quietgethist((int)x)))
+	return;
+    zle_setline(he);
+}
+
+/**/
 static zlong
 get_histno(UNUSED(Param pm))
 {