diff src/usercmd.c @ 29377:48b086982c01 v9.0.0031

patch 9.0.0031: <cmod> of user command does not have correct verbose value Commit: https://github.com/vim/vim/commit/9359e8a6d99fe2abfcbb9603339f1740d8870cc6 Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Jul 3 13:16:09 2022 +0100 patch 9.0.0031: <cmod> of user command does not have correct verbose value Problem: <cmod> of user command does not have correct verbose value. Solution: Use the value from the command modifier. (closes https://github.com/vim/vim/issues/10651)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 Jul 2022 14:30:06 +0200
parents add09d468c0d
children 5c390aa28f44
line wrap: on
line diff
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1492,10 +1492,23 @@ produce_cmdmods(char_u *buf, cmdmod_T *c
 			(cmod->cmod_flags & CMOD_ERRSILENT) ? "silent!"
 						      : "silent", &multi_mods);
     // :verbose
-    if (p_verbose > 0)
-	result += add_cmd_modifier(buf, "verbose", &multi_mods);
+    if (cmod->cmod_verbose > 0)
+    {
+	int verbose_value = cmod->cmod_verbose - 1;
+
+	if (verbose_value == 1)
+	    result += add_cmd_modifier(buf, "verbose", &multi_mods);
+	else
+	{
+	    char verbose_buf[NUMBUFLEN];
+
+	    sprintf(verbose_buf, "%dverbose", verbose_value);
+	    result += add_cmd_modifier(buf, verbose_buf, &multi_mods);
+	}
+    }
     // flags from cmod->cmod_split
     result += add_win_cmd_modifers(buf, cmod, &multi_mods);
+
     if (quote && buf != NULL)
     {
 	buf += result - 2;