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_main.c16
2 files changed, 17 insertions, 0 deletions
diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index 36d0cf396..bf8b7c0ce 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -88,6 +88,7 @@
 "recursive-edit", recursiveedit, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
 "redisplay", redisplay, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
 "redo", redo, ZLE_KEEPSUFFIX
+"reset-prompt", resetprompt, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
 "reverse-menu-complete", reversemenucomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_ISCOMP
 "run-help", processcmd, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
 "self-insert", selfinsert, ZLE_MENUCMP | ZLE_KEEPSUFFIX
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 0cfb8d9f6..6f66aa104 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -150,6 +150,8 @@ int kungetct;
 /**/
 mod_export char *zlenoargs[1] = { NULL };
 
+static char *raw_lp, *raw_rp;
+
 #ifdef FIONREAD
 static int delayzsetterm;
 #endif
@@ -785,8 +787,10 @@ zleread(char *lp, char *rp, int flags, int context)
     insmode = unset(OVERSTRIKE);
     eofsent = 0;
     resetneeded = 0;
+    raw_lp = lp;
     lpromptbuf = promptexpand(lp, 1, NULL, NULL);
     pmpt_attr = txtchange;
+    raw_rp = rp;
     rpromptbuf = promptexpand(rp, 1, NULL, NULL);
     rpmpt_attr = txtchange;
     free_prepostdisplay();
@@ -1307,6 +1311,18 @@ recursiveedit(UNUSED(char **args))
 }
 
 /**/
+int
+resetprompt(UNUSED(char **args))
+{
+    free(lpromptbuf);
+    lpromptbuf = promptexpand(raw_lp, 1, NULL, NULL);
+    free(rpromptbuf);
+    rpromptbuf = promptexpand(raw_rp, 1, NULL, NULL);
+
+    return redisplay(NULL);
+}
+
+/**/
 mod_export void
 trashzle(void)
 {