mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.2068: transparent syntax item uses start/end of containing region (#19055)
Problem: Transparent syntax item uses start/end of containing region.
Solution: Do not change the startpos and endpos of a transparent region to
that of its containing region. (Adrian Ghizaru, closes vim/vim#7349,
closes vim/vim#7391)
b46f57e87b
This commit is contained in:
parent
1b75094e3e
commit
e694e56422
@ -2381,8 +2381,6 @@ static void update_si_attr(int idx)
|
||||
} else {
|
||||
sip->si_attr = CUR_STATE(idx - 1).si_attr;
|
||||
sip->si_trans_id = CUR_STATE(idx - 1).si_trans_id;
|
||||
sip->si_h_startpos = CUR_STATE(idx - 1).si_h_startpos;
|
||||
sip->si_h_endpos = CUR_STATE(idx - 1).si_h_endpos;
|
||||
if (sip->si_cont_list == NULL) {
|
||||
sip->si_flags |= HL_TRANS_CONT;
|
||||
sip->si_cont_list = CUR_STATE(idx - 1).si_cont_list;
|
||||
|
@ -778,6 +778,82 @@ func Test_search_syntax_skip()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_syn_contained_transparent()
|
||||
" Comments starting with "Regression:" show the result when the highlighting
|
||||
" span of the containing item is assigned to the contained region.
|
||||
syntax on
|
||||
|
||||
let l:case = "Transparent region contained in region"
|
||||
new
|
||||
syntax region X start=/\[/ end=/\]/ contained transparent
|
||||
syntax region Y start=/(/ end=/)/ contains=X
|
||||
|
||||
call setline(1, "==(--[~~]--)==")
|
||||
let l:expected = " YYYYYYYYYY "
|
||||
eval AssertHighlightGroups(1, 1, l:expected, 1, l:case)
|
||||
syntax clear Y X
|
||||
bw!
|
||||
|
||||
let l:case = "Transparent region extends region"
|
||||
new
|
||||
syntax region X start=/\[/ end=/\]/ contained transparent
|
||||
syntax region Y start=/(/ end=/)/ end=/e/ contains=X
|
||||
|
||||
call setline(1, "==(--[~~e~~]--)==")
|
||||
let l:expected = " YYYYYYYYYYYYY "
|
||||
" Regression: " YYYYYYY YYY "
|
||||
eval AssertHighlightGroups(1, 1, l:expected, 1, l:case)
|
||||
syntax clear Y X
|
||||
bw!
|
||||
|
||||
let l:case = "Nested transparent regions extend region"
|
||||
new
|
||||
syntax region X start=/\[/ end=/\]/ contained transparent
|
||||
syntax region Y start=/(/ end=/)/ end=/e/ contains=X
|
||||
|
||||
call setline(1, "==(--[~~e~~[~~e~~]~~e~~]--)==")
|
||||
let l:expected = " YYYYYYYYYYYYYYYYYYYYYYYYY "
|
||||
" Regression: " YYYYYYY YYYYYYYYY "
|
||||
eval AssertHighlightGroups(1, 1, l:expected, 1, l:case)
|
||||
syntax clear Y X
|
||||
bw!
|
||||
|
||||
let l:case = "Transparent region contained in match"
|
||||
new
|
||||
syntax region X start=/\[/ end=/\]/ contained transparent
|
||||
syntax match Y /(.\{-})/ contains=X
|
||||
|
||||
call setline(1, "==(--[~~]--)==")
|
||||
let l:expected = " YYYYYYYYYY "
|
||||
eval AssertHighlightGroups(1, 1, l:expected, 1, l:case)
|
||||
syntax clear Y X
|
||||
bw!
|
||||
|
||||
let l:case = "Transparent region extends match"
|
||||
new
|
||||
syntax region X start=/\[/ end=/\]/ contained transparent
|
||||
syntax match Y /(.\{-}[e)]/ contains=X
|
||||
|
||||
call setline(1, "==(--[~~e~~]--)==")
|
||||
let l:expected = " YYYYYYYYYY "
|
||||
" Regression: " YYYYYYY "
|
||||
eval AssertHighlightGroups(1, 1, l:expected, 1, l:case)
|
||||
syntax clear Y X
|
||||
bw!
|
||||
|
||||
let l:case = "Nested transparent regions extend match"
|
||||
new
|
||||
syntax region X start=/\[/ end=/\]/ contained transparent
|
||||
syntax match Y /(.\{-}[e)]/ contains=X
|
||||
|
||||
call setline(1, "==(--[~~e~~[~~e~~]~~e~~]--)==")
|
||||
let l:expected = " YYYYYYYYYYYYYYYYYYYYYY "
|
||||
" Regression: " YYYYYYY YYYYYY "
|
||||
eval AssertHighlightGroups(1, 1, l:expected, 1, l:case)
|
||||
syntax clear Y X
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
func Test_syn_include_contains_TOP()
|
||||
let l:case = "TOP in included syntax means its group list name"
|
||||
new
|
||||
|
Loading…
Reference in New Issue
Block a user