vim-patch:9.0.0284: using static buffer for multiple completion functions

Problem:    Using static buffer for multiple completion functions.
Solution:   Use one buffer in expand_T.
5ff595d9db
This commit is contained in:
zeertzjq
2022-08-27 06:50:55 +08:00
parent 2676555b22
commit 608134794d
4 changed files with 12 additions and 16 deletions

View File

@@ -5737,9 +5737,6 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
*/
char *get_syntax_name(expand_T *xp, int idx)
{
#define CBUFFER_LEN 256
static char cbuffer[CBUFFER_LEN]; // TODO: better solution
switch (expand_what) {
case EXP_SUBCMD:
return subcommands[idx].name;
@@ -5761,9 +5758,9 @@ char *get_syntax_name(expand_T *xp, int idx)
}
case EXP_CLUSTER:
if (idx < curwin->w_s->b_syn_clusters.ga_len) {
vim_snprintf(cbuffer, CBUFFER_LEN, "@%s",
vim_snprintf(xp->xp_buf, EXPAND_BUF_LEN, "@%s",
SYN_CLSTR(curwin->w_s)[idx].scl_name);
return cbuffer;
return xp->xp_buf;
} else {
return NULL;
}