about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/iwidgets.list1
-rw-r--r--Src/Zle/zle_hist.c10
-rw-r--r--Src/Zle/zle_keymap.c4
3 files changed, 15 insertions, 0 deletions
diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index 6c82f9b61..4372fe36e 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -13,6 +13,7 @@
 "accept-and-menu-complete", acceptandmenucomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX
 "accept-line", acceptline, 0
 "accept-line-and-down-history", acceptlineanddownhistory, 0
+"accept-search", NULL, 0
 "argument-base", argumentbase, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL | ZLE_NOTCOMMAND
 "auto-suffix-remove", handlesuffix, ZLE_NOTCOMMAND
 "auto-suffix-retain", handlesuffix, ZLE_KEEPSUFFIX | ZLE_NOTCOMMAND
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index c4dad7617..aec847ec6 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -49,6 +49,10 @@ ZLE_STRING_T previous_search = NULL;
 /**/
 int previous_search_len = 0;
 
+/* Local keymap in isearch mode */
+
+/**/
+Keymap isearch_keymap;
 
 /*** History text manipulation utilities ***/
 
@@ -1141,6 +1145,8 @@ doisearch(char **args, int dir, int pattern)
     if (!(he = quietgethist(hl)))
 	return;
 
+    selectlocalmap(isearch_keymap);
+
     clearlist = 1;
 
     if (*args) {
@@ -1572,6 +1578,8 @@ doisearch(char **args, int dir, int pattern)
 		feep = 1;
 	    else
 		goto ins;
+	} else if (cmd == Th(z_acceptsearch)) {
+	    break;
 	} else {
 	    if(cmd == Th(z_selfinsertunmeta)) {
 		fixunmeta();
@@ -1640,6 +1648,8 @@ doisearch(char **args, int dir, int pattern)
      */
     if (savekeys >= 0 && kungetct > savekeys)
 	kungetct = savekeys;
+
+    selectlocalmap(NULL);
 }
 
 static Histent
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 9dac62049..30c747900 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1176,6 +1176,8 @@ default_bindings(void)
     char buf[3], *ed;
     int i;
 
+    isearch_keymap = newkeymap(NULL, "isearch");
+
     /* vi insert mode and emacs mode:  *
      *   0-31   taken from the tables  *
      *  32-126  self-insert            *
@@ -1274,6 +1276,8 @@ default_bindings(void)
     else
 	linkkeymap(emap, "main", 0);
 
+    linkkeymap(isearch_keymap, "isearch", 0);
+
     /* the .safe map cannot be modified or deleted */
     smap->flags |= KM_IMMUTABLE;
 }