forked from aniani/vim
patch 8.2.3700: text property highlighting continues over breakindent
Problem: Text property highlighting continues over breakindent. Solution: Stop before the end column. (closes #9242)
This commit is contained in:
@@ -265,6 +265,9 @@ win_line(
|
|||||||
int c_extra = NUL; // extra chars, all the same
|
int c_extra = NUL; // extra chars, all the same
|
||||||
int c_final = NUL; // final char, mandatory if set
|
int c_final = NUL; // final char, mandatory if set
|
||||||
int extra_attr = 0; // attributes when n_extra != 0
|
int extra_attr = 0; // attributes when n_extra != 0
|
||||||
|
#ifdef FEAT_LINEBREAK
|
||||||
|
int in_linebreak = FALSE; // n_extra set for showing linebreak
|
||||||
|
#endif
|
||||||
static char_u *at_end_str = (char_u *)""; // used for p_extra when
|
static char_u *at_end_str = (char_u *)""; // used for p_extra when
|
||||||
// displaying eol at end-of-line
|
// displaying eol at end-of-line
|
||||||
int lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used
|
int lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used
|
||||||
@@ -1419,7 +1422,11 @@ win_line(
|
|||||||
int pi;
|
int pi;
|
||||||
int bcol = (int)(ptr - line);
|
int bcol = (int)(ptr - line);
|
||||||
|
|
||||||
if (n_extra > 0)
|
if (n_extra > 0
|
||||||
|
# ifdef FEAT_LINEBREAK
|
||||||
|
&& !in_linebreak
|
||||||
|
# endif
|
||||||
|
)
|
||||||
--bcol; // still working on the previous char, e.g. Tab
|
--bcol; // still working on the previous char, e.g. Tab
|
||||||
|
|
||||||
// Check if any active property ends.
|
// Check if any active property ends.
|
||||||
@@ -1437,6 +1444,11 @@ win_line(
|
|||||||
* (text_props_active - (pi + 1)));
|
* (text_props_active - (pi + 1)));
|
||||||
--text_props_active;
|
--text_props_active;
|
||||||
--pi;
|
--pi;
|
||||||
|
# ifdef FEAT_LINEBREAK
|
||||||
|
// not exactly right but should work in most cases
|
||||||
|
if (in_linebreak && syntax_attr == text_prop_attr)
|
||||||
|
syntax_attr = 0;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1705,6 +1717,10 @@ win_line(
|
|||||||
++p_extra;
|
++p_extra;
|
||||||
}
|
}
|
||||||
--n_extra;
|
--n_extra;
|
||||||
|
#ifdef FEAT_LINEBREAK
|
||||||
|
if (n_extra <= 0)
|
||||||
|
in_linebreak = FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2030,6 +2046,8 @@ win_line(
|
|||||||
|
|
||||||
c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
|
c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
|
||||||
c_final = NUL;
|
c_final = NUL;
|
||||||
|
if (n_extra > 0)
|
||||||
|
in_linebreak = TRUE;
|
||||||
if (VIM_ISWHITE(c))
|
if (VIM_ISWHITE(c))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
|
10
src/testdir/dumps/Test_prop_linebreak.dump
Normal file
10
src/testdir/dumps/Test_prop_linebreak.dump
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
>x+0&#ffffff0@49|]+0#ffffff16#e000002| +0#0000000#ffffff0@23
|
||||||
|
|x@69| @4
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
| +0#0000000&@56|1|,|1| @10|A|l@1|
|
@@ -1615,6 +1615,24 @@ def Test_prop_add_delete_line()
|
|||||||
bwipe!
|
bwipe!
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
func Test_prop_in_linebreak()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set breakindent linebreak breakat+=]
|
||||||
|
call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
|
||||||
|
call prop_type_add('test', #{highlight: 'ErrorMsg'})
|
||||||
|
call prop_add(1, 51, #{length: 1, type: 'test'})
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XscriptPropLinebreak')
|
||||||
|
let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10})
|
||||||
|
call TermWait(buf)
|
||||||
|
call VerifyScreenDump(buf, 'Test_prop_linebreak', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XscriptPropLinebreak')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Buffer number of 0 should be ignored, as if the parameter wasn't passed.
|
" Buffer number of 0 should be ignored, as if the parameter wasn't passed.
|
||||||
def Test_prop_bufnr_zero()
|
def Test_prop_bufnr_zero()
|
||||||
new
|
new
|
||||||
|
@@ -753,6 +753,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 */
|
||||||
|
/**/
|
||||||
|
3700,
|
||||||
/**/
|
/**/
|
||||||
3699,
|
3699,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user