aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-27 06:50:55 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-27 07:03:07 +0800
commit608134794d2a039358825396b860a7f432c1a4bd (patch)
tree2a6d4599e7549786d624756ac8d6e4cfd46fce83 /src/nvim/syntax.c
parent2676555b229feae462df32bf6dfce7f234b7be53 (diff)
downloadrneovim-608134794d2a039358825396b860a7f432c1a4bd.tar.gz
rneovim-608134794d2a039358825396b860a7f432c1a4bd.tar.bz2
rneovim-608134794d2a039358825396b860a7f432c1a4bd.zip
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. https://github.com/vim/vim/commit/5ff595d9db2d9a33aa10cc9f18f256826226862f
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index de8d5ef638..20287089f7 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -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;
}