vim-patch:7.4.639

Problem:    Combination of linebreak and conceal doesn't work well.
Solution:   Fix the display problems. (Christian Brabandt)

8fc6bc7126
This commit is contained in:
watiko 2016-01-25 03:55:47 +09:00
parent 50393ef178
commit d25a59f4d0
5 changed files with 86 additions and 18 deletions

View File

@ -3410,7 +3410,7 @@ win_line (
int i; int i;
int saved_nextra = n_extra; int saved_nextra = n_extra;
if ((is_concealing || boguscols > 0) && vcol_off > 0) { if (vcol_off > 0) {
// there are characters to conceal // there are characters to conceal
tab_len += vcol_off; tab_len += vcol_off;
} }
@ -3440,25 +3440,31 @@ win_line (
// n_extra will be increased by FIX_FOX_BOGUSCOLS // n_extra will be increased by FIX_FOX_BOGUSCOLS
// macro below, so need to adjust for that here // 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; 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 int vc_saved = vcol_off;
* and boguscols accumulated so far in the line. Note that
* the tab can be longer than 'tabstop' when there // Tab alignment should be identical regardless of
* are concealed characters. */ // 'conceallevel' value. So tab compensates of all
FIX_FOR_BOGUSCOLS; // previous concealed characters, and thus resets
// Make sure that the highlighting for the tab char will be correctly // vcol_off and boguscols accumulated so far in the
// set further below (effectively reverts the FIX_FOR_BOGSUCOLS // line. Note that the tab can be longer than
// macro). // 'tabstop' when there are concealed characters.
if (old_boguscols > 0 && n_extra > tab_len && wp->w_p_list FIX_FOR_BOGUSCOLS;
&& lcs_tab1) {
tab_len += n_extra - tab_len; // 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) { if (wp->w_p_list) {
c = lcs_tab1; c = lcs_tab1;
if (wp->w_p_lbr) { if (wp->w_p_lbr) {

View File

@ -71,6 +71,17 @@ GGk
:set lbr :set lbr
:normal $ :normal $
GGk GGk
:set list listchars=tab:>-
:normal 0
GGk
:normal W
GGk
:normal W
GGk
:normal W
GGk
:normal $
GGk
:" Display result. :" Display result.
:call append('$', 'end:') :call append('$', 'end:')
:call append('$', positions) :call append('$', positions)

View File

@ -22,3 +22,8 @@ end:
9:25 9:25
9:26 9:26
9:26 9:26
9:1
9:9
9:17
9:25
9:26

View File

@ -485,7 +485,7 @@ static int included_patches[] = {
642, 642,
// 641 NA // 641 NA
640, 640,
// 639, 639,
// 638 NA // 638 NA
637, 637,
636, 636,

View File

@ -2,6 +2,7 @@
local helpers = require('test.functional.helpers') local helpers = require('test.functional.helpers')
local source = helpers.source local source = helpers.source
local feed = helpers.feed
local clear, expect = helpers.clear, helpers.expect local clear, expect = helpers.clear, helpers.expect
describe('linebreak', function() describe('linebreak', function()
@ -61,6 +62,43 @@ describe('linebreak', function()
redraw! redraw!
let line=ScreenChar(winwidth(0),7) let line=ScreenChar(winwidth(0),7)
call DoRecordScreen() 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. -- Assert buffer contents.
@ -102,6 +140,14 @@ describe('linebreak', function()
#define >CDEFGH>----1 #define >CDEFGH>----1
#define >_FILE>--------->--->---1 #define >_FILE>--------->--->---1
#define >_CONSOLE>---------->---2 #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)
end) end)