changeset 29136:ff98d9c228d4 v8.2.5088

patch 8.2.5088: value of cmod_verbose is a bit complicated to use Commit: https://github.com/vim/vim/commit/cd7496382efc9e6748326c6cda7f01003fa07063 Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Jun 14 13:30:35 2022 +0100 patch 8.2.5088: value of cmod_verbose is a bit complicated to use Problem: Value of cmod_verbose is a bit complicated to use. Solution: Use zero for not set, value + 1 when set. (closes https://github.com/vim/vim/issues/10564)
author Bram Moolenaar <Bram@vim.org>
date Tue, 14 Jun 2022 14:45:06 +0200
parents 9b6a0ff3d5e5
children 88d66707bf3f
files src/ex_docmd.c src/ex_getln.c src/globals.h src/structs.h src/version.c
diffstat 5 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3089,12 +3089,11 @@ parse_command_modifiers(
 			    break;
 			if (vim_isdigit(*eap->cmd))
 			{
-			    cmod->cmod_verbose = atoi((char *)eap->cmd);
-			    if (cmod->cmod_verbose == 0)
-				cmod->cmod_verbose = -1;
+			    // zero means not set, one is verbose == 0, etc.
+			    cmod->cmod_verbose = atoi((char *)eap->cmd) + 1;
 			}
 			else
-			    cmod->cmod_verbose = 1;
+			    cmod->cmod_verbose = 2;  // default: verbose == 1
 			eap->cmd = p;
 			continue;
 	}
@@ -3147,7 +3146,7 @@ has_cmdmod(cmdmod_T *cmod, int ignore_si
 		|| (cmod->cmod_flags
 		      & ~(CMOD_SILENT | CMOD_ERRSILENT | CMOD_UNSILENT)) != 0))
 	    || cmod->cmod_split != 0
-	    || cmod->cmod_verbose != 0
+	    || cmod->cmod_verbose > 0
 	    || cmod->cmod_tab != 0
 	    || cmod->cmod_filter_regmatch.regprog != NULL;
 }
@@ -3182,11 +3181,11 @@ apply_cmdmod(cmdmod_T *cmod)
 	cmod->cmod_did_sandbox = TRUE;
     }
 #endif
-    if (cmod->cmod_verbose != 0)
+    if (cmod->cmod_verbose > 0)
     {
 	if (cmod->cmod_verbose_save == 0)
 	    cmod->cmod_verbose_save = p_verbose + 1;
-	p_verbose = cmod->cmod_verbose < 0 ? 0 : cmod->cmod_verbose;
+	p_verbose = cmod->cmod_verbose - 1;
     }
 
     if ((cmod->cmod_flags & (CMOD_SILENT | CMOD_UNSILENT))
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -256,7 +256,6 @@ do_incsearch_highlighting(
     ea.cmd = ccline.cmdbuff;
     ea.addr_type = ADDR_LINES;
 
-    CLEAR_FIELD(dummy_cmdmod);
     parse_command_modifiers(&ea, &dummy, &dummy_cmdmod, TRUE);
 
     cmd = skip_range(ea.cmd, TRUE, NULL);
--- a/src/globals.h
+++ b/src/globals.h
@@ -1291,7 +1291,7 @@ EXTERN pos_T	last_cursormoved	      // f
 
 EXTERN int	postponed_split INIT(= 0);  // for CTRL-W CTRL-] command
 EXTERN int	postponed_split_flags INIT(= 0);  // args for win_split()
-EXTERN int	postponed_split_tab INIT(= 0);  // cmdmod.tab
+EXTERN int	postponed_split_tab INIT(= 0);  // cmdmod.cmod_tab
 #ifdef FEAT_QUICKFIX
 EXTERN int	g_do_tagpreview INIT(= 0);  // for tag preview commands:
 					    // height of preview window
--- a/src/structs.h
+++ b/src/structs.h
@@ -662,8 +662,8 @@ typedef struct
     regmatch_T	cmod_filter_regmatch;	// set by :filter /pat/
     int		cmod_filter_force;	// set for :filter!
 
-    int		cmod_verbose;		// non-zero to set 'verbose', -1 is
-					// used for zero override
+    int		cmod_verbose;		// 0 if not set, > 0 to set 'verbose'
+					// to cmod_verbose - 1
 
     // values for undo_cmdmod()
     char_u	*cmod_save_ei;		// saved value of 'eventignore'
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    5088,
+/**/
     5087,
 /**/
     5086,