Skip to content

Commit 32a214e

Browse files
committed
patch 7.4.949
Problem: When using 'colorcolumn' and there is a sign with a fullwidth character the highlighting is wrong. (Andrew Stewart) Solution: Only increment vcol when in the right state. (Christian Brabandt)
1 parent 20ad69c commit 32a214e

4 files changed

Lines changed: 54 additions & 2 deletions

File tree

src/screen.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5422,7 +5422,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
54225422
else
54235423
/* DBCS: Put second byte in the second screen char. */
54245424
ScreenLines[off] = mb_c & 0xff;
5425-
++vcol;
5425+
if (draw_state > WL_NR
5426+
#ifdef FEAT_DIFF
5427+
&& filler_todo <= 0
5428+
#endif
5429+
)
5430+
++vcol;
54265431
/* When "tocol" is halfway a character, set it to the end of
54275432
* the character, otherwise highlighting won't stop. */
54285433
if (tocol == vcol)

src/testdir/test_listlbr_utf8.in

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Test for linebreak and list option in utf-8 mode
22

33
STARTTEST
44
:so small.vim
5-
:if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif
5+
:if !exists("+linebreak") || !has("conceal") || !has("signs") | e! test.ok | w! test.out | qa! | endif
66
:so mbyte.vim
77
:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif
88
:10new|:vsp|:vert resize 20
@@ -25,6 +25,7 @@ STARTTEST
2525
: $put =g:line
2626
: wincmd p
2727
:endfu
28+
:"
2829
:let g:test ="Test 1: set linebreak + set list + fancy listchars"
2930
:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
3031
:redraw!
@@ -45,6 +46,7 @@ STARTTEST
4546
:redraw!
4647
:let line=ScreenChar(winwidth(0),4)
4748
:call DoRecordScreen()
49+
:"
4850
:let g:test ="Test 4: set linebreak list listchars and concealing"
4951
:let c_defines=['#define ABCDE 1','#define ABCDEF 1','#define ABCDEFG 1','#define ABCDEFGH 1', '#define MSG_MODE_FILE 1','#define MSG_MODE_CONSOLE 2','#define MSG_MODE_FILE_AND_CONSOLE 3','#define MSG_MODE_FILE_THEN_CONSOLE 4']
5052
:call append('$', c_defines)
@@ -56,6 +58,7 @@ STARTTEST
5658
:redraw!
5759
:let line=ScreenChar(winwidth(0),7)
5860
:call DoRecordScreen()
61+
:"
5962
:let g:test ="Test 5: set linebreak list listchars and concealing part2"
6063
:let c_defines=['bbeeeeee ; some text']
6164
:call append('$', c_defines)
@@ -74,6 +77,7 @@ STARTTEST
7477
:redraw!
7578
:let line=ScreenChar(winwidth(0),1)
7679
:call DoRecordScreen()
80+
:"
7781
:let g:test ="Test 6: Screenattributes for comment"
7882
:$put =g:test
7983
:call append('$', ' /* and some more */')
@@ -92,10 +96,39 @@ GGlGGlGGlGGlGGlGGlGGlGGlGGlGGl
9296
: call append('$', "Not all attributes are different")
9397
:endif
9498
:set cpo&vim linebreak selection=exclusive
99+
:"
95100
:let g:test ="Test 8: set linebreak with visual block mode and v_b_A and selection=exclusive and multibyte char"
96101
:$put =g:test
97102
Golong line: 40afoobar aTARGETÃ' at end
98103
:exe "norm! $3B\<C-v>eAx\<Esc>"
104+
:"
105+
:let g:test ="Test 9: a multibyte sign and colorcolumn"
106+
:let attr=[]
107+
:let attr2=[]
108+
:$put =''
109+
:$put ='a b c'
110+
:$put ='a b c'
111+
:set list nolinebreak cc=3
112+
:sign define foo text=+
113+
:sign place 1 name=foo line=50 buffer=2
114+
:norm! 2kztj
115+
:let line1=line('.')
116+
0GGlGGlGGlGGl
117+
:let line2=line('.')
118+
:let attr2=attr
119+
:let attr=[]
120+
0GGlGGlGGlGGl
121+
:redraw!
122+
:let line=ScreenChar(winwidth(0),3)
123+
:call DoRecordScreen()
124+
:call append('$', ['ScreenAttributes for test9:'])
125+
:call append('$', ["Line: ".line1. " ". string(g:attr),"Line: ".line2. " ". string(g:attr2)])
126+
:" expected: attr[2] is different because of colorcolumn
127+
:if attr[0] != attr2[0] || attr[1] != attr2[1] || attr[2] != attr2[2]
128+
: call append('$', "Screen attributes are different!")
129+
:else
130+
: call append('$', "Screen attributes are the same!")
131+
:endif
99132
:%w! test.out
100133
:qa!
101134
ENDTEST

src/testdir/test_listlbr_utf8.ok

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,15 @@ ScreenAttributes for test6:
4646
Attribut 0 and 1 and 3 and 5 are different!
4747
Test 8: set linebreak with visual block mode and v_b_A and selection=exclusive and multibyte char
4848
long line: foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar TARGETÃx' at end
49+
50+
a b c
51+
a b c
52+
53+
Test 9: a multibyte sign and colorcolumn
54+
¶
55+
+a b c¶
56+
a b c¶
57+
ScreenAttributes for test9:
58+
Line: 50 ['0', '0', '72', '0']
59+
Line: 51 ['0', '0', '72', '0']
60+
Screen attributes are the same!

src/version.c

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

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
949,
744746
/**/
745747
948,
746748
/**/

0 commit comments

Comments
 (0)