Skip to content

Commit ad5e563

Browse files
committed
patch 8.2.1689: 'colorcolumn' doesn't show in indent
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)
1 parent c8f12c9 commit ad5e563

5 files changed

Lines changed: 63 additions & 1 deletion

File tree

src/drawline.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2775,8 +2775,12 @@ win_line(
27752775
// highlight the cursor position itself.
27762776
// Also highlight the 'colorcolumn' if it is different than
27772777
// 'cursorcolumn'
2778+
// Also highlight the 'colorcolumn' if 'breakindent' and/or 'showbreak'
2779+
// options are set
27782780
vcol_save_attr = -1;
2779-
if (draw_state == WL_LINE && !lnum_in_visual_area
2781+
if ((draw_state == WL_LINE ||
2782+
draw_state == WL_BRI ||
2783+
draw_state == WL_SBR) && !lnum_in_visual_area
27802784
&& search_attr == 0 && area_attr == 0)
27812785
{
27822786
if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
>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
2+
@1| +0&#ffffff0|l+0&#ffd7d7255|a+0&#ffffff0|z|y| |d|o|g|s| @28
3+
|~+0#4040ff13&| @38
4+
|~| @38
5+
|~| @38
6+
|~| @38
7+
|~| @38
8+
|~| @38
9+
|~| @38
10+
| +0#0000000&@21|1|,|1| @10|A|l@1|
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
>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
2+
|++0#4040ff13&|++0&#ffffff0|++0&#ffd7d7255|>+0&#ffffff0| | +0#0000000&|d|o|g|s| @29
3+
|~+0#4040ff13&| @38
4+
|~| @38
5+
|~| @38
6+
|~| @38
7+
|~| @38
8+
|~| @38
9+
|~| @38
10+
| +0#0000000&@21|1|,|1| @10|A|l@1|

src/testdir/test_highlight.vim

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,42 @@ func Test_colorcolumn()
662662
call delete('Xtest_colorcolumn')
663663
endfunc
664664

665+
func Test_colorcolumn_bri()
666+
CheckScreendump
667+
668+
" check 'colorcolumn' when 'breakindent' is set
669+
let lines =<< trim END
670+
call setline(1, 'The quick brown fox jumped over the lazy dogs')
671+
END
672+
call writefile(lines, 'Xtest_colorcolumn_bri')
673+
let buf = RunVimInTerminal('-S Xtest_colorcolumn_bri', {'rows': 10,'columns': 40})
674+
call term_sendkeys(buf, ":set co=40 linebreak bri briopt=shift:2 cc=40,41,43\<CR>")
675+
call TermWait(buf)
676+
call VerifyScreenDump(buf, 'Test_colorcolumn_2', {})
677+
678+
" clean up
679+
call StopVimInTerminal(buf)
680+
call delete('Xtest_colorcolumn_bri')
681+
endfunc
682+
683+
func Test_colorcolumn_sbr()
684+
CheckScreendump
685+
686+
" check 'colorcolumn' when 'showbreak' is set
687+
let lines =<< trim END
688+
call setline(1, 'The quick brown fox jumped over the lazy dogs')
689+
END
690+
call writefile(lines, 'Xtest_colorcolumn_srb')
691+
let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40})
692+
call term_sendkeys(buf, ":set co=40 showbreak=+++>\\ cc=40,41,43\<CR>")
693+
call TermWait(buf)
694+
call VerifyScreenDump(buf, 'Test_colorcolumn_3', {})
695+
696+
" clean up
697+
call StopVimInTerminal(buf)
698+
call delete('Xtest_colorcolumn_srb')
699+
endfunc
700+
665701
" This test must come before the Test_cursorline test, as it appears this
666702
" defines the Normal highlighting group anyway.
667703
func Test_1_highlight_Normalgroup_exists()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1689,
753755
/**/
754756
1688,
755757
/**/

0 commit comments

Comments
 (0)