diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-31 20:02:56 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-31 20:02:56 +0100 |
commit | a6c18d38ca2df0a92403f2265a480d9dba08290f (patch) | |
tree | ac3af2c88f7576100428d53d3b9aae6bbf993f8c /src/eval.c | |
parent | ccbfd4883f0385a1d84cc87785ddcc86185b4ad9 (diff) |
patch 8.2.4657: errors for functions are sometimes hard to readv8.2.4657
Problem: Errors for functions are sometimes hard to read.
Solution: Use printable_func_name() in more places.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/eval.c b/src/eval.c index 4447186e22..0d24f76888 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5296,15 +5296,29 @@ echo_string_core( break; case VAR_FUNC: - if (echo_style) { - *tofree = NULL; - r = tv->vval.v_string; - } - else - { - *tofree = string_quote(tv->vval.v_string, TRUE); - r = *tofree; + char_u buf[MAX_FUNC_NAME_LEN]; + + if (echo_style) + { + r = make_ufunc_name_readable(tv->vval.v_string, + buf, MAX_FUNC_NAME_LEN); + if (r == buf) + { + r = vim_strsave(buf); + *tofree = r; + } + else + *tofree = NULL; + } + else + { + *tofree = string_quote(tv->vval.v_string == NULL ? NULL + : make_ufunc_name_readable( + tv->vval.v_string, buf, MAX_FUNC_NAME_LEN), + TRUE); + r = *tofree; + } } break; |