mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.0672: third item of synconcealed() changes too often
Problem: Third item of synconcealed() changes too often. (Dominique Pelle) Solution: Reset the sequence number at the start of each line.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 8.0. Last change: 2017 Jun 23
|
*eval.txt* For Vim version 8.0. Last change: 2017 Jun 24
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -7663,12 +7663,21 @@ synconcealed({lnum}, {col}) *synconcealed()*
|
|||||||
is 1, the second item contains the text which will be
|
is 1, the second item contains the text which will be
|
||||||
displayed in place of the concealed text, depending on the
|
displayed in place of the concealed text, depending on the
|
||||||
current setting of 'conceallevel' and 'listchars'.
|
current setting of 'conceallevel' and 'listchars'.
|
||||||
3. The third and final item in the list is a unique number
|
3. The third and final item in the list is a number
|
||||||
representing the specific syntax region matched. This
|
representing the specific syntax region matched in the
|
||||||
allows detection of the beginning of a new concealable
|
line. When the character is not concealed the value is
|
||||||
region if there are two consecutive regions with the same
|
zero. This allows detection of the beginning of a new
|
||||||
replacement character. For an example use see
|
concealable region if there are two consecutive regions
|
||||||
$VIMRUNTIME/syntax/2html.vim .
|
with the same replacement character. For an example, if
|
||||||
|
the text is "123456" and both "23" and "45" are concealed
|
||||||
|
and replace by the character "X", then:
|
||||||
|
call returns ~
|
||||||
|
synconcealed(lnum, 1) [0, '', 0]
|
||||||
|
synconcealed(lnum, 2) [1, 'X', 1]
|
||||||
|
synconcealed(lnum, 3) [1, 'X', 1]
|
||||||
|
synconcealed(lnum, 4) [1, 'X', 2]
|
||||||
|
synconcealed(lnum, 5) [1, 'X', 2]
|
||||||
|
synconcealed(lnum, 6) [0, '', 0]
|
||||||
|
|
||||||
|
|
||||||
synstack({lnum}, {col}) *synstack()*
|
synstack({lnum}, {col}) *synstack()*
|
||||||
|
@@ -1061,6 +1061,7 @@ syn_start_line(void)
|
|||||||
|
|
||||||
next_match_idx = -1;
|
next_match_idx = -1;
|
||||||
++current_line_id;
|
++current_line_id;
|
||||||
|
next_seqnr = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1857,6 +1858,7 @@ get_syntax_attr(
|
|||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_CONCEAL
|
#ifdef FEAT_CONCEAL
|
||||||
current_flags = 0;
|
current_flags = 0;
|
||||||
|
current_seqnr = 0;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2346,6 +2348,7 @@ syn_current_attr(
|
|||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_CONCEAL
|
#ifdef FEAT_CONCEAL
|
||||||
current_flags = 0;
|
current_flags = 0;
|
||||||
|
current_seqnr = 0;
|
||||||
#endif
|
#endif
|
||||||
if (cur_si != NULL)
|
if (cur_si != NULL)
|
||||||
{
|
{
|
||||||
|
@@ -474,24 +474,24 @@ func Test_conceal()
|
|||||||
|
|
||||||
set conceallevel=0
|
set conceallevel=0
|
||||||
call assert_equal('123456 ', ScreenLines(2, 7)[0])
|
call assert_equal('123456 ', ScreenLines(2, 7)[0])
|
||||||
call assert_equal([[0, ''], [0, ''], [0, ''], [0, ''], [0, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
call assert_equal([[0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)'))
|
||||||
|
|
||||||
set conceallevel=1
|
set conceallevel=1
|
||||||
call assert_equal('1X 6 ', ScreenLines(2, 7)[0])
|
call assert_equal('1X 6 ', ScreenLines(2, 7)[0])
|
||||||
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ' '], [1, ' '], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, ' ', 2], [1, ' ', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)'))
|
||||||
|
|
||||||
set conceallevel=1
|
set conceallevel=1
|
||||||
set listchars=conceal:Y
|
set listchars=conceal:Y
|
||||||
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, 'Y'], [1, 'Y'], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, 'Y', 2], [1, 'Y', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)'))
|
||||||
call assert_equal('1XY6 ', ScreenLines(2, 7)[0])
|
call assert_equal('1XY6 ', ScreenLines(2, 7)[0])
|
||||||
|
|
||||||
set conceallevel=2
|
set conceallevel=2
|
||||||
call assert_match('1X6 ', ScreenLines(2, 7)[0])
|
call assert_match('1X6 ', ScreenLines(2, 7)[0])
|
||||||
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
call assert_equal([[0, '', 0], [1, 'X', 1], [1, 'X', 1], [1, '', 2], [1, '', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)'))
|
||||||
|
|
||||||
set conceallevel=3
|
set conceallevel=3
|
||||||
call assert_match('16 ', ScreenLines(2, 7)[0])
|
call assert_match('16 ', ScreenLines(2, 7)[0])
|
||||||
call assert_equal([[0, ''], [1, ''], [1, ''], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
call assert_equal([[0, '', 0], [1, '', 1], [1, '', 1], [1, '', 2], [1, '', 2], [0, '', 0]], map(range(1, 6), 'synconcealed(2, v:val)'))
|
||||||
|
|
||||||
syn clear
|
syn clear
|
||||||
set conceallevel&
|
set conceallevel&
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
672,
|
||||||
/**/
|
/**/
|
||||||
671,
|
671,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user