diff src/eval.c @ 28263:c446812efd60 v8.2.4657

patch 8.2.4657: errors for functions are sometimes hard to read Commit: https://github.com/vim/vim/commit/a6c18d38ca2df0a92403f2265a480d9dba08290f Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 31 20:02:56 2022 +0100 patch 8.2.4657: errors for functions are sometimes hard to read Problem: Errors for functions are sometimes hard to read. Solution: Use printable_func_name() in more places.
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Mar 2022 21:15:03 +0200
parents 22c8cafe8c9c
children fff70771d4bb
line wrap: on
line diff
--- 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;