0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2022-08-26 22:36:41 +01:00
parent af9a6002e0
commit 5ff595d9db
5 changed files with 21 additions and 24 deletions

View File

@@ -6420,11 +6420,8 @@ set_context_in_syntax_cmd(expand_T *xp, char_u *arg)
* expansion.
*/
char_u *
get_syntax_name(expand_T *xp UNUSED, int idx)
get_syntax_name(expand_T *xp, int idx)
{
#define CBUFFER_LEN 256
static char_u cbuffer[CBUFFER_LEN]; // TODO: better solution
switch (expand_what)
{
case EXP_SUBCMD:
@@ -6452,9 +6449,9 @@ get_syntax_name(expand_T *xp UNUSED, int idx)
{
if (idx < curwin->w_s->b_syn_clusters.ga_len)
{
vim_snprintf((char *)cbuffer, CBUFFER_LEN, "@%s",
vim_snprintf((char *)xp->xp_buf, EXPAND_BUF_LEN, "@%s",
SYN_CLSTR(curwin->w_s)[idx].scl_name);
return cbuffer;
return xp->xp_buf;
}
else
return NULL;