From a8c4ed64ee684227c0dd3142e912f7faca8bd1fb Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 31 Jan 2014 14:01:12 +0100 Subject: 32314: merge undo events corresponding to vi change in the vi-cmd-mode widget so undo from insert mode is useful again --- Src/Zle/zle_tricky.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Src/Zle/zle_tricky.c') diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 9d163ad9e..2689d0fa1 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -611,8 +611,7 @@ docomplete(int lst) active = 1; comprecursive = 0; makecommaspecial(0); - if (undoing) - setlastline(); + setlastline(); /* From the C-code's point of view, we can only use compctl as a default * type of completion. Load it if it hasn't been loaded already and -- cgit v1.2.3 From 620b915c4e1df33cc5df679408518281cfb81f93 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 2 Feb 2014 13:37:36 -0800 Subject: Fix leading whitespace in a comment --- ChangeLog | 2 ++ Src/Zle/zle_tricky.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'Src/Zle/zle_tricky.c') diff --git a/ChangeLog b/ChangeLog index 1515bd34e..fe427c2fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-02-02 Barton E. Schaefer + * unposted: Src/Zle/zle_tricky.c: whitespace in comment + * 32340: Src/init.c, Src/Zle/compctl.c: Add specifics to error messages explaining failure of "read -c" / "read -l". diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 2689d0fa1..a12fa08ff 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -1163,7 +1163,7 @@ get_comp_string(void) * being separated by tokens | & &! |& || &&). The loop stops when * * the end of the command containing the cursor is reached. What * * makes this messy is checking for things like redirections, loops * - * and whatnot. */ + * and whatnot. */ do { qsub = noword = 0; -- cgit v1.2.3 From 90916c4e085138da26c34b1d0da826f7804293f7 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 14 Feb 2014 22:51:33 +0100 Subject: 32361: don't reset lastline before completion --- ChangeLog | 4 ++++ Src/Zle/zle_tricky.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Src/Zle/zle_tricky.c') diff --git a/ChangeLog b/ChangeLog index f6ef20115..848527bdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-02-14 Oliver Kiddle + + * 32361: Src/Zle/zle_tricky.c: don't reset lastline before completion + 2014-02-13 Barton E. Schaefer * 32377: Test/comptest: change keybindings and PTY control for diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index a12fa08ff..3c7cff9c1 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -611,7 +611,6 @@ docomplete(int lst) active = 1; comprecursive = 0; makecommaspecial(0); - setlastline(); /* From the C-code's point of view, we can only use compctl as a default * type of completion. Load it if it hasn't been loaded already and -- cgit v1.2.3 From f61037a0b04616f40f5c849a5f590232f3cff235 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 6 Apr 2014 09:55:49 -0700 Subject: 32531: fix memory leaks detected by valgrind --- ChangeLog | 6 ++++++ Src/Zle/zle_refresh.c | 3 +++ Src/Zle/zle_tricky.c | 1 + Src/hist.c | 3 ++- 4 files changed, 12 insertions(+), 1 deletion(-) (limited to 'Src/Zle/zle_tricky.c') diff --git a/ChangeLog b/ChangeLog index a9088ed29..5dda3c932 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-04-06 Barton E. Schaefer + + * 32531: Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, Src/hist.c: + fix memory leaks detected by valgrind, two in ZLE region highlight + and one in :A history modifier. + 2014-04-06 Peter Stephenson * Sebastian Ramacher: 32533: Completion/Debian/Command/_apt: add diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 8ce678756..80be27f03 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -444,6 +444,7 @@ void set_region_highlight(UNUSED(Param pm), char **aval) { int len; + char **av = aval; struct region_highlight *rhp; len = aval ? arrlen(aval) : 0; @@ -490,6 +491,8 @@ set_region_highlight(UNUSED(Param pm), char **aval) match_highlight(strp, &rhp->atr); } + + freearray(av); } diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 3c7cff9c1..b916bd653 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -2795,6 +2795,7 @@ doexpandhist(void) if (!err) { zlemetacs = excs; if (strcmp(zlemetaline, ol)) { + zle_restore_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/hist.c b/Src/hist.c index 1845bd8ad..16249125b 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -1764,7 +1764,8 @@ chrealpath(char **junkptr) str++; } - *junkptr = metafy(bicat(real, nonreal), -1, META_HEAPDUP); + *junkptr = metafy(str = bicat(real, nonreal), -1, META_HEAPDUP); + zsfree(str); #ifdef HAVE_CANONICALIZE_FILE_NAME free(real); #endif -- cgit v1.2.3 From 31e2ae380a8ab9d49345294e70842a64cb565432 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 13 Apr 2014 01:26:07 -0700 Subject: 32540: in doexpandhist(), discard saved line position data rather than restoring from it (updates 32531). --- ChangeLog | 6 ++++++ Src/Zle/zle_tricky.c | 2 +- Src/Zle/zle_utils.c | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) (limited to 'Src/Zle/zle_tricky.c') diff --git a/ChangeLog b/ChangeLog index cbecd574a..35910c316 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-04-13 Barton E. Schaefer + + * 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 * 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 @@ -709,6 +709,27 @@ zle_restore_positions(void) zfree(oldpos, sizeof(*oldpos)); } +/* + * 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 -- cgit v1.2.3