]> granicus.if.org Git - vim/commitdiff
patch 8.2.0235: draw error when an empty group is removed from 'statusline' v8.2.0235
authorBram Moolenaar <Bram@vim.org>
Sat, 8 Feb 2020 17:35:31 +0000 (18:35 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 8 Feb 2020 17:35:31 +0000 (18:35 +0100)
Problem:    Draw error when an empty group is removed from 'statusline'.
Solution:   Do not use highlighting from a removed group.

src/buffer.c
src/testdir/dumps/Test_statusline_1.dump [new file with mode: 0644]
src/testdir/test_statusline.vim
src/version.c

index 7ff80977373b579e737a334ffd2191a8841b3729..25620afb5dcb416d29eef3b7cd545773074c2b02 100644 (file)
@@ -4216,6 +4216,10 @@ build_stl_str_hl(
                {
                    p = t;
                    l = 0;
+                   // do not use the highlighting from the removed group
+                   for (n = groupitem[groupdepth] + 1; n < curitem; n++)
+                       if (item[n].type == Highlight)
+                           item[n].type = Empty;
                }
            }
            if (l > item[groupitem[groupdepth]].maxwid)
diff --git a/src/testdir/dumps/Test_statusline_1.dump b/src/testdir/dumps/Test_statusline_1.dump
new file mode 100644 (file)
index 0000000..f981685
--- /dev/null
@@ -0,0 +1,10 @@
+> +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+| +3#0000000&|Q|≡| @46
+| +0&&@49
index 1f705b847ff04b9a354a4bb51ac91c453a787e28..ebfe8aac66b5647f4cb87be6b38269ba2dc066fa 100644 (file)
@@ -8,6 +8,7 @@
 
 source view_util.vim
 source check.vim
+source screendump.vim
 
 func s:get_statusline()
   return ScreenLines(&lines - 1, &columns)[0]
@@ -393,3 +394,22 @@ func Test_statusline_visual()
   bwipe! x1
   bwipe! x2
 endfunc
+
+func Test_statusline_removed_group()
+  CheckScreendump
+
+  let lines =<< trim END
+    scriptencoding utf-8
+    set laststatus=2
+    let &statusline = '%#StatColorHi2#%(✓%#StatColorHi2#%) Q≡'
+  END
+  call writefile(lines, 'XTest_statusline')
+
+  let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 10, 'cols': 50})
+  call term_wait(buf, 100)
+  call VerifyScreenDump(buf, 'Test_statusline_1', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XTest_statusline')
+endfunc
index e1c6e319bf0f537d4752a2e45a35fbd56de657d3..6a5f2e779c371b1d29b2ba71f0b04552677cf5dd 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    235,
 /**/
     234,
 /**/