about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-04-13 01:26:07 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-04-13 01:26:07 -0700
commit31e2ae380a8ab9d49345294e70842a64cb565432 (patch)
tree394e6d549394beaded834196da04266cda441782 /Src
parent141089231c9731811939d6ce24888fc95693eb6e (diff)
downloadzsh-31e2ae380a8ab9d49345294e70842a64cb565432.tar.gz
zsh-31e2ae380a8ab9d49345294e70842a64cb565432.tar.xz
zsh-31e2ae380a8ab9d49345294e70842a64cb565432.zip
32540: in doexpandhist(), discard saved line position data rather than restoring from it (updates 32531).
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_tricky.c2
-rw-r--r--Src/Zle/zle_utils.c21
2 files changed, 22 insertions, 1 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index b916bd653..499c4ae77 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2795,7 +2795,7 @@ doexpandhist(void)
     if (!err) {
 	zlemetacs = excs;
 	if (strcmp(zlemetaline, ol)) {
-	    zle_restore_positions();
+	    zle_free_positions();
 	    unmetafy_line();
 	    /* For vi mode -- reset the beginning-of-insertion pointer   *
 	     * to the beginning of the line.  This seems a little silly, *
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 9cfa8813d..1089e274f 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -710,6 +710,27 @@ zle_restore_positions(void)
 }
 
 /*
+ * Discard positions previously saved, the line has been updated.
+ */
+
+/**/
+mod_export void
+zle_free_positions(void)
+{
+    struct zle_position *oldpos = zle_positions;
+    struct zle_region *oldrhp;
+
+    zle_positions = oldpos->next;
+    oldrhp = oldpos->regions;
+    while (oldrhp) {
+	struct zle_region *nextrhp = oldrhp->next;
+	zfree(oldrhp, sizeof(*oldrhp));
+	oldrhp = nextrhp;
+    }
+    zfree(oldpos, sizeof(*oldpos));
+}
+
+/*
  * Basic utility functions for adding to line or removing from line.
  * At this level the counts supplied are raw character counts, so
  * the calling code must be aware of combining characters where