about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 6b2c2a653..4d672deab 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -58,8 +58,8 @@ int excs, exlast;
  * the line does not get added to the list until hend(), if at all.
  * However, curhist is incremented to reflect the current line anyway
  * and a temporary history entry is inserted while the user is editing.
- * If the resulting line was not added to the list, curhist is
- * decremented in hend().
+ * If the resulting line was not added to the list, a flag is set so
+ * that curhist will be decremented in hbegin().
  */
  
 /**/
@@ -984,6 +984,8 @@ hend(void)
 void
 remhist(void)
 {
+    if (hist_ring == &curline)
+	return;
     if (!(histactive & HA_ACTIVE)) {
 	if (!(histactive & HA_JUNKED)) {
 	    freehistnode((HashNode)hist_ring);