Skip to content

Commit eeb23f8

Browse files
committed
updated for version 7.4.639
Problem: Combination of linebreak and conceal doesn't work well. Solution: Fix the display problems. (Christian Brabandt)
1 parent 6bfa74b commit eeb23f8

File tree

6 files changed

+80
-14
lines changed

6 files changed

+80
-14
lines changed

src/screen.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4571,7 +4571,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
45714571
int saved_nextra = n_extra;
45724572

45734573
#ifdef FEAT_CONCEAL
4574-
if ((is_concealing || boguscols > 0) && vcol_off > 0)
4574+
if (vcol_off > 0)
45754575
/* there are characters to conceal */
45764576
tab_len += vcol_off;
45774577
/* boguscols before FIX_FOR_BOGUSCOLS macro from above
@@ -4609,25 +4609,30 @@ win_line(wp, lnum, startrow, endrow, nochange)
46094609
#ifdef FEAT_CONCEAL
46104610
/* n_extra will be increased by FIX_FOX_BOGUSCOLS
46114611
* macro below, so need to adjust for that here */
4612-
if ((is_concealing || boguscols > 0) && vcol_off > 0)
4612+
if (vcol_off > 0)
46134613
n_extra -= vcol_off;
46144614
#endif
46154615
}
46164616
#endif
46174617
#ifdef FEAT_CONCEAL
4618-
/* Tab alignment should be identical regardless of
4619-
* 'conceallevel' value. So tab compensates of all
4620-
* previous concealed characters, and thus resets vcol_off
4621-
* and boguscols accumulated so far in the line. Note that
4622-
* the tab can be longer than 'tabstop' when there
4623-
* are concealed characters. */
4624-
FIX_FOR_BOGUSCOLS;
4625-
/* Make sure, the highlighting for the tab char will be
4626-
* correctly set further below (effectively reverts the
4627-
* FIX_FOR_BOGSUCOLS macro */
4628-
if (old_boguscols > 0 && n_extra > tab_len && wp->w_p_list
4618+
{
4619+
int vc_saved = vcol_off;
4620+
4621+
/* Tab alignment should be identical regardless of
4622+
* 'conceallevel' value. So tab compensates of all
4623+
* previous concealed characters, and thus resets
4624+
* vcol_off and boguscols accumulated so far in the
4625+
* line. Note that the tab can be longer than
4626+
* 'tabstop' when there are concealed characters. */
4627+
FIX_FOR_BOGUSCOLS;
4628+
4629+
/* Make sure, the highlighting for the tab char will be
4630+
* correctly set further below (effectively reverts the
4631+
* FIX_FOR_BOGSUCOLS macro */
4632+
if (n_extra == tab_len + vc_saved && wp->w_p_list
46294633
&& lcs_tab1)
4630-
tab_len += n_extra - tab_len;
4634+
tab_len += vc_saved;
4635+
}
46314636
#endif
46324637
#ifdef FEAT_MBYTE
46334638
mb_utf8 = FALSE; /* don't draw as UTF-8 */

src/testdir/test88.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ GGk
7171
:set lbr
7272
:normal $
7373
GGk
74+
:set list listchars=tab:>-
75+
:normal 0
76+
GGk
77+
:normal W
78+
GGk
79+
:normal W
80+
GGk
81+
:normal W
82+
GGk
83+
:normal $
84+
GGk
7485
:" Display result.
7586
:call append('$', 'end:')
7687
:call append('$', positions)

src/testdir/test88.ok

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ end:
2222
9:25
2323
9:26
2424
9:26
25+
9:1
26+
9:9
27+
9:17
28+
9:25
29+
9:26

src/testdir/test_listlbr_utf8.in

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,41 @@ STARTTEST
5656
:redraw!
5757
:let line=ScreenChar(winwidth(0),7)
5858
:call DoRecordScreen()
59+
:let g:test ="Test 5: set linebreak list listchars and concealing part2"
60+
:let c_defines=['bbeeeeee ; some text']
61+
:call append('$', c_defines)
62+
:$
63+
:norm! zt
64+
:set nowrap ts=2 list linebreak listchars=tab:>- cole=2 concealcursor=n
65+
:syn clear
66+
:syn match meaning /;\s*\zs.*/
67+
:syn match hasword /^\x\{8}/ contains=word
68+
:syn match word /\<\x\{8}\>/ contains=beginword,endword contained
69+
:syn match beginword /\<\x\x/ contained conceal
70+
:syn match endword /\x\{6}\>/ contained
71+
:hi meaning guibg=blue
72+
:hi beginword guibg=green
73+
:hi endword guibg=red
74+
:redraw!
75+
:let line=ScreenChar(winwidth(0),1)
76+
:call DoRecordScreen()
77+
:let g:test ="Test 6: Screenattributes for comment"
78+
:$put =g:test
79+
:call append('$', ' /* and some more */')
80+
:exe "set ft=c ts=7 linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
81+
:syntax on
82+
:hi SpecialKey term=underline ctermfg=red guifg=red
83+
:let attr=[]
84+
:nnoremap <expr> GG ":let attr += ['".screenattr(screenrow(),screencol())."']\n"
85+
:$
86+
:norm! zt0
87+
GGlGGlGGlGGlGGlGGlGGlGGlGGlGGl
88+
:call append('$', ['ScreenAttributes for test6:'])
89+
:if attr[0] != attr[1] && attr[1] != attr[3] && attr[3] != attr[5]
90+
: call append('$', "Attribut 0 and 1 and 3 and 5 are different!")
91+
:else
92+
: call append('$', "Not all attributes are different")
93+
:endif
5994
:%w! test.out
6095
:qa!
6196
ENDTEST

src/testdir/test_listlbr_utf8.ok

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@ Test 4: set linebreak list listchars and concealing
3636
#define >_FILE>--------->--->---1
3737
#define >_CONSOLE>---------->---2
3838
#define >_FILE_AND_CONSOLE>---------3
39+
bbeeeeee ; some text
40+
41+
Test 5: set linebreak list listchars and concealing part2
42+
eeeeee>--->-;>some text
43+
Test 6: Screenattributes for comment
44+
/* and some more */
45+
ScreenAttributes for test6:
46+
Attribut 0 and 1 and 3 and 5 are different!

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+
639,
744746
/**/
745747
638,
746748
/**/

0 commit comments

Comments
 (0)