0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 8.1.2019: 'cursorline' always highlights the whole line

Problem:    'cursorline' always highlights the whole line.
Solution:   Add 'cursorlineopt' to specify what is highlighted.
            (closes #4693)
This commit is contained in:
Bram Moolenaar
2019-09-09 22:05:49 +02:00
parent e5fbd73930
commit 410e98a70b
13 changed files with 172 additions and 9 deletions

View File

@@ -3817,7 +3817,7 @@ win_line(
{
// Do not show the cursor line when Visual mode is active, because it's
// not clear what is selected then. Do update w_last_cursorline.
if (!(wp == curwin && VIsual_active))
if (!(wp == curwin && VIsual_active) && *wp->w_p_culopt != 'n')
{
line_attr = HL_ATTR(HLF_CUL);
area_highlighting = TRUE;
@@ -4021,6 +4021,7 @@ win_line(
* TODO: Can we use CursorLine instead of CursorLineNr
* when CursorLineNr isn't set? */
if ((wp->w_p_cul || wp->w_p_rnu)
&& *wp->w_p_culopt != 'l'
&& lnum == wp->w_cursor.lnum)
char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN));
#endif
@@ -4055,7 +4056,8 @@ win_line(
{
char_attr = HL_ATTR(diff_hlf);
# ifdef FEAT_SYN_HL
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
&& *wp->w_p_culopt != 'n')
char_attr = hl_combine_attr(char_attr,
HL_ATTR(HLF_CUL));
# endif
@@ -4117,7 +4119,8 @@ win_line(
tocol += n_extra;
#ifdef FEAT_SYN_HL
/* combine 'showbreak' with 'cursorline' */
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
&& *wp->w_p_culopt != 'n')
char_attr = hl_combine_attr(char_attr,
HL_ATTR(HLF_CUL));
#endif
@@ -4212,7 +4215,8 @@ win_line(
&& n_extra == 0)
diff_hlf = HLF_CHD; /* changed line */
line_attr = HL_ATTR(diff_hlf);
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
&& *wp->w_p_culopt != 'n')
line_attr = hl_combine_attr(line_attr, HL_ATTR(HLF_CUL));
}
#endif
@@ -5180,7 +5184,8 @@ win_line(
if (vi_attr == 0 || char_attr != vi_attr)
{
char_attr = HL_ATTR(diff_hlf);
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
&& *wp->w_p_culopt != 'n')
char_attr = hl_combine_attr(char_attr,
HL_ATTR(HLF_CUL));
}