diff options
-rw-r--r-- | src/nvim/screen.c | 38 | ||||
-rw-r--r-- | src/nvim/testdir/test88.in | 11 | ||||
-rw-r--r-- | src/nvim/testdir/test88.ok | 5 | ||||
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | test/functional/legacy/listlbr_utf8_spec.lua | 48 |
5 files changed, 86 insertions, 18 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index c6d1ea790e..0d0c645c3d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3410,7 +3410,7 @@ win_line ( int i; int saved_nextra = n_extra; - if ((is_concealing || boguscols > 0) && vcol_off > 0) { + if (vcol_off > 0) { // there are characters to conceal tab_len += vcol_off; } @@ -3440,25 +3440,31 @@ win_line ( // n_extra will be increased by FIX_FOX_BOGUSCOLS // macro below, so need to adjust for that here - if ((is_concealing || boguscols > 0) && vcol_off > 0) { + if (vcol_off > 0) { n_extra -= vcol_off; } } - /* Tab alignment should be identical regardless of - * 'conceallevel' value. So tab compensates of all - * previous concealed characters, and thus resets vcol_off - * and boguscols accumulated so far in the line. Note that - * the tab can be longer than 'tabstop' when there - * are concealed characters. */ - FIX_FOR_BOGUSCOLS; - // Make sure that the highlighting for the tab char will be correctly - // set further below (effectively reverts the FIX_FOR_BOGSUCOLS - // macro). - if (old_boguscols > 0 && n_extra > tab_len && wp->w_p_list - && lcs_tab1) { - tab_len += n_extra - tab_len; + + { + int vc_saved = vcol_off; + + // Tab alignment should be identical regardless of + // 'conceallevel' value. So tab compensates of all + // previous concealed characters, and thus resets + // vcol_off and boguscols accumulated so far in the + // line. Note that the tab can be longer than + // 'tabstop' when there are concealed characters. + FIX_FOR_BOGUSCOLS; + + // Make sure, the highlighting for the tab char will be + // correctly set further below (effectively reverts the + // FIX_FOR_BOGSUCOLS macro. + if (n_extra == tab_len + vc_saved && wp->w_p_list && lcs_tab1) { + tab_len += vc_saved; + } } - mb_utf8 = FALSE; /* don't draw as UTF-8 */ + + mb_utf8 = (int)false; // don't draw as UTF-8 if (wp->w_p_list) { c = lcs_tab1; if (wp->w_p_lbr) { diff --git a/src/nvim/testdir/test88.in b/src/nvim/testdir/test88.in index c2e6a752fa..9e43f703e9 100644 --- a/src/nvim/testdir/test88.in +++ b/src/nvim/testdir/test88.in @@ -71,6 +71,17 @@ GGk :set lbr :normal $ GGk +:set list listchars=tab:>- +:normal 0 +GGk +:normal W +GGk +:normal W +GGk +:normal W +GGk +:normal $ +GGk :" Display result. :call append('$', 'end:') :call append('$', positions) diff --git a/src/nvim/testdir/test88.ok b/src/nvim/testdir/test88.ok index e29698b7bd..12949f274a 100644 --- a/src/nvim/testdir/test88.ok +++ b/src/nvim/testdir/test88.ok @@ -22,3 +22,8 @@ end: 9:25 9:26 9:26 +9:1 +9:9 +9:17 +9:25 +9:26 diff --git a/src/nvim/version.c b/src/nvim/version.c index bf1986d3ba..2ffe41d6fd 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -485,7 +485,7 @@ static int included_patches[] = { 642, // 641 NA 640, - // 639, + 639, // 638 NA 637, 636, diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua index 69e7b87a21..a327ae1857 100644 --- a/test/functional/legacy/listlbr_utf8_spec.lua +++ b/test/functional/legacy/listlbr_utf8_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers') local source = helpers.source +local feed = helpers.feed local clear, expect = helpers.clear, helpers.expect describe('linebreak', function() @@ -61,6 +62,43 @@ describe('linebreak', function() redraw! let line=ScreenChar(winwidth(0),7) call DoRecordScreen() + let g:test ="Test 5: set linebreak list listchars and concealing part2" + let c_defines=['bbeeeeee ; some text'] + call append('$', c_defines) + $ + norm! zt + set nowrap ts=2 list linebreak listchars=tab:>- cole=2 concealcursor=n + syn clear + syn match meaning /;\s*\zs.*/ + syn match hasword /^\x\{8}/ contains=word + syn match word /\<\x\{8}\>/ contains=beginword,endword contained + syn match beginword /\<\x\x/ contained conceal + syn match endword /\x\{6}\>/ contained + hi meaning guibg=blue + hi beginword guibg=green + hi endword guibg=red + redraw! + let line=ScreenChar(winwidth(0),1) + call DoRecordScreen() + let g:test ="Test 6: Screenattributes for comment" + $put =g:test + call append('$', ' /* and some more */') + exe "set ft=c ts=7 linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" + syntax on + hi SpecialKey term=underline ctermfg=red guifg=red + let attr=[] + nnoremap <expr> GG ":let attr += ['".screenattr(screenrow(),screencol())."']\n" + $ + norm! zt0 + ]]) + feed('GGlGGlGGlGGlGGlGGlGGlGGlGGlGGl') + source([[ + call append('$', ['ScreenAttributes for test6:']) + if attr[0] != attr[1] && attr[1] != attr[3] && attr[3] != attr[5] + call append('$', "Attribut 0 and 1 and 3 and 5 are different!") + else + call append('$', "Not all attributes are different") + endif ]]) -- Assert buffer contents. @@ -102,6 +140,14 @@ describe('linebreak', function() #define >CDEFGH>----1 #define >_FILE>--------->--->---1 #define >_CONSOLE>---------->---2 - #define >_FILE_AND_CONSOLE>---------3 ]]) + #define >_FILE_AND_CONSOLE>---------3 + bbeeeeee ; some text + + Test 5: set linebreak list listchars and concealing part2 + eeeeee>--->-;>some text + Test 6: Screenattributes for comment + /* and some more */ + ScreenAttributes for test6: + Attribut 0 and 1 and 3 and 5 are different!]]) end) end) |