1 Pick up a couple of post-5.2 patches from the list (so no need to push |
|
2 these upstream). |
|
3 |
|
4 Fix a segfault in zsh (workers/37337). |
|
5 |
|
6 diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h |
|
7 index 2d672de..e9b1428 100644 |
|
8 --- a/Src/Zle/zle.h |
|
9 +++ b/Src/Zle/zle.h |
|
10 @@ -213,6 +213,8 @@ struct widget { |
|
11 #define ZLE_KEEPSUFFIX (1<<9) /* DON'T remove added suffix */ |
|
12 #define ZLE_NOTCOMMAND (1<<10) /* widget should not alter lastcmd */ |
|
13 #define ZLE_ISCOMP (1<<11) /* usable for new style completion */ |
|
14 +#define WIDGET_INUSE (1<<12) /* widget is in use */ |
|
15 +#define WIDGET_FREE (1<<13) /* request to free when no longer in use */ |
|
16 |
|
17 /* thingies */ |
|
18 |
|
19 diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c |
|
20 index 38427e8..1f0c07d 100644 |
|
21 --- a/Src/Zle/zle_main.c |
|
22 +++ b/Src/Zle/zle_main.c |
|
23 @@ -1344,6 +1344,8 @@ execzlefunc(Thingy func, char **args, int set_bindk) |
|
24 eofsent = 1; |
|
25 ret = 1; |
|
26 } else { |
|
27 + int inuse = wflags & WIDGET_INUSE; |
|
28 + w->flags |= WIDGET_INUSE; |
|
29 if(!(wflags & ZLE_KEEPSUFFIX)) |
|
30 removesuffix(); |
|
31 if(!(wflags & ZLE_MENUCMP)) { |
|
32 @@ -1367,6 +1369,12 @@ execzlefunc(Thingy func, char **args, int set_bindk) |
|
33 ret = w->u.fn(args); |
|
34 unqueue_signals(); |
|
35 } |
|
36 + if (!inuse) { |
|
37 + if (w->flags & WIDGET_FREE) |
|
38 + freewidget(w); |
|
39 + else |
|
40 + w->flags &= ~WIDGET_INUSE; |
|
41 + } |
|
42 if (!(wflags & ZLE_NOTCOMMAND)) |
|
43 lastcmd = wflags; |
|
44 } |
|
45 @@ -1387,6 +1395,8 @@ execzlefunc(Thingy func, char **args, int set_bindk) |
|
46 int osc = sfcontext, osi = movefd(0); |
|
47 int oxt = isset(XTRACE); |
|
48 LinkList largs = NULL; |
|
49 + int inuse = w->flags & WIDGET_INUSE; |
|
50 + w->flags |= WIDGET_INUSE; |
|
51 |
|
52 if (*args) { |
|
53 largs = newlinklist(); |
|
54 @@ -1402,8 +1412,15 @@ execzlefunc(Thingy func, char **args, int set_bindk) |
|
55 opts[XTRACE] = oxt; |
|
56 sfcontext = osc; |
|
57 endparamscope(); |
|
58 - lastcmd = w->flags; |
|
59 - w->flags = 0; |
|
60 + lastcmd = w->flags & ~(WIDGET_INUSE|WIDGET_FREE); |
|
61 + if (inuse) { |
|
62 + w->flags &= WIDGET_INUSE|WIDGET_FREE; |
|
63 + } else { |
|
64 + if (w->flags & WIDGET_FREE) |
|
65 + freewidget(w); |
|
66 + else |
|
67 + w->flags = 0; |
|
68 + } |
|
69 r = 1; |
|
70 redup(osi, 0); |
|
71 } |
|
72 diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c |
|
73 index 271fd8e..21495b6 100644 |
|
74 --- a/Src/Zle/zle_thingy.c |
|
75 +++ b/Src/Zle/zle_thingy.c |
|
76 @@ -253,9 +253,14 @@ unbindwidget(Thingy t, int override) |
|
77 /* Free a widget. */ |
|
78 |
|
79 /**/ |
|
80 -static void |
|
81 +void |
|
82 freewidget(Widget w) |
|
83 { |
|
84 + if (w->flags & WIDGET_INUSE) { |
|
85 + w->flags |= WIDGET_FREE; |
|
86 + return; |
|
87 + } |
|
88 + |
|
89 if (w->flags & WIDGET_NCOMP) { |
|
90 zsfree(w->u.comp.wid); |
|
91 zsfree(w->u.comp.func); |
|
92 |
|
93 |
|
94 Fix a bug with bindkey and unicode characters (users/21071). |
|
95 |
|
96 diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c |
|
97 index 069580f..d6d116b 100644 |
|
98 --- a/Src/Zle/zle_keymap.c |
|
99 +++ b/Src/Zle/zle_keymap.c |
|
100 @@ -1503,7 +1503,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp) |
|
101 f->widget->flags & ZLE_VIOPER); |
|
102 #ifdef MULTIBYTE_SUPPORT |
|
103 if ((f == Th(z_selfinsert) || f == Th(z_selfinsertunmeta)) && |
|
104 - !lastchar_wide_valid) { |
|
105 + !lastchar_wide_valid && !ispfx) { |
|
106 int len; |
|
107 VARARR(char, mbc, MB_CUR_MAX); |
|
108 ZLE_INT_T inchar = getrestchar(lastchar, mbc, &len); |
|
109 |
|
110 |
|
111 _subscript - fix completion of associative array keys (workers/37788) |
|
112 |
|
113 diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript |
|
114 index 0ccc0c4..679f129 100644 |
|
115 --- a/Completion/Zsh/Context/_subscript |
|
116 +++ b/Completion/Zsh/Context/_subscript |
|
117 @@ -81,8 +81,8 @@ elif compset -P '\('; then |
|
118 elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then |
|
119 local suf MATCH MBEGIN MEND |
|
120 local -a keys |
|
121 - keys=(${${(kP)compstate[parameter]}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH}) |
|
122 - keys=(${keys//#%(#m)[*@]/(e)$MATCH}) |
|
123 + keys=("${(@)${(@k)${(P)compstate[parameter]}}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH}") |
|
124 + keys=("${(@)keys//#%(#m)[*@]/(e)$MATCH}") |
|
125 [[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf" |
|
126 |
|
127 _wanted association-keys expl 'association key' \ |
|