]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0146: v:echospace wrong with invalid value of 'showcmdloc' v9.1.0146
authorzeertzjq <zeertzjq@outlook.com>
Fri, 1 Mar 2024 22:01:43 +0000 (23:01 +0100)
committerChristian Brabandt <cb@256bit.org>
Fri, 1 Mar 2024 22:03:16 +0000 (23:03 +0100)
Problem:  v:echospace wrong after setting invalid value to 'showcmdloc'.
Solution: Only call comp_col() if value is valid.
          (zeertzjq)

closes: #14119

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/optionstr.c
src/testdir/test_messages.vim
src/version.c

index 771423c641692ea9133e52bdb85f41eb4ac5813f..e5f4946b445ad010e0d76d849c88952bbc2c8604 100644 (file)
@@ -3440,8 +3440,12 @@ did_set_showbreak(optset_T *args)
     char *
 did_set_showcmdloc(optset_T *args UNUSED)
 {
-    comp_col();
-    return did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
+    char       *errmsg = did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
+
+    if (errmsg == NULL)
+       comp_col();
+
+    return errmsg;
 }
 
     int
index 8d0a422809ad114a3b346e347519127ebb1645e8..46f336834614f6200844210dee25cde17edecee9 100644 (file)
@@ -166,6 +166,12 @@ func Test_echospace()
   call assert_equal(&columns - 19, v:echospace)
   set showcmdloc=tabline
   call assert_equal(&columns - 19, v:echospace)
+  call assert_fails('set showcmdloc=leap', 'E474:')
+  call assert_equal(&columns - 19, v:echospace)
+  set showcmdloc=last
+  call assert_equal(&columns - 29, v:echospace)
+  call assert_fails('set showcmdloc=jump', 'E474:')
+  call assert_equal(&columns - 29, v:echospace)
 
   set ruler& showcmd& showcmdloc&
 endfunc
index 5842f46d5a2b0a064ffd8665a473cbbdadcef18e..e7ee9466b392201585c67832f4d48f73d31a9b8d 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    146,
 /**/
     145,
 /**/