summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/zle_tricky.c2
-rw-r--r--Src/Zle/zle_utils.c21
3 files changed, 28 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cbecd574a..35910c316 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-13 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 32540: Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c: following
+ successful history expansion, discard saved line position data
+ rather than restoring from it (updates 32531).
+
2014-04-07 Peter Stephenson <p.stephenson@samsung.com>
* 32527: Doc/Zsh/contrib.yo, Functions/Misc/zcalc,
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