]> granicus.if.org Git - vim/commitdiff
patch 8.2.1689: 'colorcolumn' doesn't show in indent v8.2.1689
authorBram Moolenaar <Bram@vim.org>
Tue, 15 Sep 2020 18:52:26 +0000 (20:52 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 15 Sep 2020 18:52:26 +0000 (20:52 +0200)
Problem:    'colorcolumn' doesn't show in indent.
Solution:   Also draw the column when draw_state is WL_BRI or WL_SBR.
            (Alexey Demin, closes #6948, closes #6619)

src/drawline.c
src/testdir/dumps/Test_colorcolumn_2.dump [new file with mode: 0644]
src/testdir/dumps/Test_colorcolumn_3.dump [new file with mode: 0644]
src/testdir/test_highlight.vim
src/version.c

index 2b72de6489250e6c44768aa0262393324d62e0f0..82738f13cda7b5ee2cffbde0d240c47611f5a160 100644 (file)
@@ -2775,8 +2775,12 @@ win_line(
        // highlight the cursor position itself.
        // Also highlight the 'colorcolumn' if it is different than
        // 'cursorcolumn'
+       // Also highlight the 'colorcolumn' if 'breakindent' and/or 'showbreak'
+       // options are set
        vcol_save_attr = -1;
-       if (draw_state == WL_LINE && !lnum_in_visual_area
+       if ((draw_state == WL_LINE ||
+            draw_state == WL_BRI ||
+            draw_state == WL_SBR) && !lnum_in_visual_area
                && search_attr == 0 && area_attr == 0)
        {
            if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol
diff --git a/src/testdir/dumps/Test_colorcolumn_2.dump b/src/testdir/dumps/Test_colorcolumn_2.dump
new file mode 100644 (file)
index 0000000..44e0e7a
--- /dev/null
@@ -0,0 +1,10 @@
+>T+0&#ffffff0|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|e|d| |o|v|e|r| |t|h|e| @3| +0&#ffd7d7255
+@1| +0&#ffffff0|l+0&#ffd7d7255|a+0&#ffffff0|z|y| |d|o|g|s| @28
+|~+0#4040ff13&| @38
+|~| @38
+|~| @38
+|~| @38
+|~| @38
+|~| @38
+|~| @38
+| +0#0000000&@21|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_colorcolumn_3.dump b/src/testdir/dumps/Test_colorcolumn_3.dump
new file mode 100644 (file)
index 0000000..6cb0c24
--- /dev/null
@@ -0,0 +1,10 @@
+>T+0&#ffffff0|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|e|d| |o|v|e|r| |t|h|e| |l|a|z|y+0&#ffd7d7255
+|++0#4040ff13&|++0&#ffffff0|++0&#ffd7d7255|>+0&#ffffff0| | +0#0000000&|d|o|g|s| @29
+|~+0#4040ff13&| @38
+|~| @38
+|~| @38
+|~| @38
+|~| @38
+|~| @38
+|~| @38
+| +0#0000000&@21|1|,|1| @10|A|l@1| 
index b5e382f1a5195cd565f5284f7df4d71e61f57eff..4f2e238e45ac5899b4f79099c9bb924cd32823b5 100644 (file)
@@ -662,6 +662,42 @@ func Test_colorcolumn()
   call delete('Xtest_colorcolumn')
 endfunc
 
+func Test_colorcolumn_bri()
+  CheckScreendump
+
+  " check 'colorcolumn' when 'breakindent' is set
+  let lines =<< trim END
+       call setline(1, 'The quick brown fox jumped over the lazy dogs')
+  END
+  call writefile(lines, 'Xtest_colorcolumn_bri')
+  let buf = RunVimInTerminal('-S Xtest_colorcolumn_bri', {'rows': 10,'columns': 40})
+  call term_sendkeys(buf, ":set co=40 linebreak bri briopt=shift:2 cc=40,41,43\<CR>")
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_colorcolumn_2', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('Xtest_colorcolumn_bri')
+endfunc
+
+func Test_colorcolumn_sbr()
+  CheckScreendump
+
+  " check 'colorcolumn' when 'showbreak' is set
+  let lines =<< trim END
+       call setline(1, 'The quick brown fox jumped over the lazy dogs')
+  END
+  call writefile(lines, 'Xtest_colorcolumn_srb')
+  let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40})
+  call term_sendkeys(buf, ":set co=40 showbreak=+++>\\  cc=40,41,43\<CR>")
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_colorcolumn_3', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('Xtest_colorcolumn_srb')
+endfunc
+
 " This test must come before the Test_cursorline test, as it appears this
 " defines the Normal highlighting group anyway.
 func Test_1_highlight_Normalgroup_exists()
index 23006e1ed51511942ddbcc8bc791b230ee103e23..f4b02418ed57581622cc611fd5b23c2f43d117b8 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1689,
 /**/
     1688,
 /**/