diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-12-09 16:40:18 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-09 16:40:18 +0000 |
commit | c4ec338fb80ebfb5d631f0718fdd1a1c04d9ed82 (patch) | |
tree | 7d7f953f0a5a9de830e4a972f08d92fdf25be4ef /src/eval.c | |
parent | dcb53be4418fe263a71c7738315241031df6c986 (diff) | |
download | vim-git-c4ec338fb80ebfb5d631f0718fdd1a1c04d9ed82.tar.gz |
patch 8.2.3766: converting a funcref to a string leaves out "g:"v8.2.3766
Problem: Converting a funcref to a string leaves out "g:", causing the
meaning of the name depending on the context.
Solution: Prepend "g:" for a global function.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index bc4db2906..1e2e4c476 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5006,7 +5006,15 @@ echo_string_core( ga_concat(&ga, (char_u *)"function("); if (fname != NULL) { - ga_concat(&ga, fname); + // When using uf_name prepend "g:" for a global function. + if (pt->pt_name == NULL && fname[0] == '\'' + && vim_isupper(fname[1])) + { + ga_concat(&ga, (char_u *)"'g:"); + ga_concat(&ga, fname + 1); + } + else + ga_concat(&ga, fname); vim_free(fname); } if (pt != NULL && pt->pt_argc > 0) |