Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] termquery: don't warn about creating .term.* params
- X-seq: zsh-workers 54144
- From: dana <dana@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] termquery: don't warn about creating .term.* params
- Date: Tue, 09 Dec 2025 00:09:25 -0600
- Archived-at: <https://zsh.org/workers/54144>
- Feedback-id: i9be146f9:Fastmail
- List-id: <zsh-workers.zsh.org>
i've just updated my main shell to a recent master build for the first
time in quite a while and noticed a bunch of new warn_create_global
warnings in my config. this is the smallest reproduction i could come up
with:
% zsh -dfic 'setopt warn_create_global; () { zle -N x }'
(anon): scalar parameter .term.mode created globally in function (anon)
(anon): scalar parameter .term.bg created globally in function (anon)
(anon): scalar parameter .term.fg created globally in function (anon)
(anon): scalar parameter .term.cursor created globally in function (anon)
attached fixes it but i'm not sure if it's the right way to do it?
dana
diff --git a/Src/Zle/termquery.c b/Src/Zle/termquery.c
index a2d617db8..a802f7965 100644
--- a/Src/Zle/termquery.c
+++ b/Src/Zle/termquery.c
@@ -450,9 +450,9 @@ handle_color(int bg, int red, int green, int blue)
memo_term_color |= TXT_ATTR_BG_24BIT | (zattr) ((((red << 8)
+ green) << 8) + blue) << TXT_ATTR_BG_COL_SHIFT;
/* scale by Rec.709 coefficients for lightness */
- setsparam(MODEVAR, ztrdup(
+ assignsparam(MODEVAR, ztrdup(
0.2126f * red + 0.7152f * green + 0.0722f * blue <= 127 ?
- "dark" : "light"));
+ "dark" : "light"), 0);
break;
case 2: /* cursor color */
memo_cursor = (red << 24) | (green << 16) | (blue << 8);
@@ -461,7 +461,7 @@ handle_color(int bg, int red, int green, int blue)
colour = zalloc(8);
sprintf(colour, "#%02x%02x%02x", red, green, blue);
- setsparam(COLORVAR[bg], colour);
+ assignsparam(COLORVAR[bg], colour, 0);
}
/* roughly corresponding feature names */
@@ -484,18 +484,18 @@ handle_query(int sequence, int *numbers, int len, char *capture, int clen,
case 2: /* kitty keyboard */
feat = zshcalloc(2 * sizeof(char *));
*feat = ztrdup(features[3]);
- assignaparam(EXTVAR, feat, ASSPM_WARN|ASSPM_AUGMENT);
+ assignaparam(EXTVAR, feat, ASSPM_AUGMENT);
break;
case 3: /* truecolor */
feat = zshcalloc(2 * sizeof(char *));
*feat = ztrdup(features[4]);
- assignaparam(EXTVAR, feat, ASSPM_WARN|ASSPM_AUGMENT);
+ assignaparam(EXTVAR, feat, ASSPM_AUGMENT);
break;
case 4: /* id */
- setsparam(IDVAR, ztrduppfx(capture, clen));
+ assignsparam(IDVAR, ztrduppfx(capture, clen), 0);
break;
case 5: /* version */
- setsparam(VERVAR, ztrduppfx(capture, clen));
+ assignsparam(VERVAR, ztrduppfx(capture, clen), 0);
break;
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author