about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2018-01-08 17:25:04 +0000
committerPeter Stephenson <pws@zsh.org>2018-01-08 17:26:33 +0000
commit36fcaeb16799738631d4519e74d2e6398478776d (patch)
tree89fbcdf5ab344050e575cc5000ec7df68435e453 /Src/hist.c
parent0f0b602415961aa9ca069c9719a0fbb4bbb9941f (diff)
downloadzsh-36fcaeb16799738631d4519e74d2e6398478776d.tar.gz
zsh-36fcaeb16799738631d4519e74d2e6398478776d.tar.xz
zsh-36fcaeb16799738631d4519e74d2e6398478776d.zip
42245: Abort last word on interactve comment.
Last recorded word should be the previous one.
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 177250f31..e08984f00 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -46,6 +46,9 @@ void (*hwaddc) _((int));
 void (*hwbegin) _((int));
 
 /**/
+void (*hwabort) _((void));
+
+/**/
 void (*hwend) _((void));
 
 /**/
@@ -250,6 +253,7 @@ hist_context_save(struct hist_stack *hs, int toplevel)
     hs->hungetc = hungetc;
     hs->hwaddc = hwaddc;
     hs->hwbegin = hwbegin;
+    hs->hwabort = hwabort;
     hs->hwend = hwend;
     hs->addtoline = addtoline;
     hs->hlinesz = hlinesz;
@@ -294,6 +298,7 @@ hist_context_restore(const struct hist_stack *hs, int toplevel)
     hungetc = hs->hungetc;
     hwaddc = hs->hwaddc;
     hwbegin = hs->hwbegin;
+    hwabort = hs->hwabort;
     hwend = hs->hwend;
     addtoline = hs->addtoline;
     hlinesz = hs->hlinesz;
@@ -986,6 +991,11 @@ nohw(UNUSED(int c))
 }
 
 static void
+nohwabort(void)
+{
+}
+
+static void
 nohwe(void)
 {
 }
@@ -1057,6 +1067,7 @@ hbegin(int dohist)
 	hungetc = inungetc;
 	hwaddc = nohw;
 	hwbegin = nohw;
+	hwabort = nohwabort;
 	hwend = nohwe;
 	addtoline = nohw;
     } else {
@@ -1066,6 +1077,7 @@ hbegin(int dohist)
 	hungetc = ihungetc;
 	hwaddc = ihwaddc;
 	hwbegin = ihwbegin;
+	hwabort = ihwabort;
 	hwend = ihwend;
 	addtoline = iaddtoline;
 	if (!isset(BANGHIST))
@@ -1571,6 +1583,16 @@ ihwbegin(int offset)
     chwords[chwordpos++] = hptr - chline + offset;
 }
 
+/* Abort current history word, not needed */
+
+/**/
+void
+ihwabort(void)
+{
+    if (chwordpos%2)
+	chwordpos--;
+}
+
 /* add a word to the history List */
 
 /**/