comparison src/screen.c @ 18047:6650e3dff8d4 v8.1.2019

patch 8.1.2019: 'cursorline' always highlights the whole line Commit: https://github.com/vim/vim/commit/410e98a70bc00ea4bed51e55a8fe20e56a72c087 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 9 22:05:49 2019 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 09 Sep 2019 22:15:04 +0200
parents 079e10a49ea1
children 1101eacc1444
comparison
equal deleted inserted replaced
18046:4b4c49dee5e6 18047:6650e3dff8d4
3815 // Cursor line highlighting for 'cursorline' in the current window. 3815 // Cursor line highlighting for 'cursorline' in the current window.
3816 if (wp->w_p_cul && lnum == wp->w_cursor.lnum) 3816 if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
3817 { 3817 {
3818 // Do not show the cursor line when Visual mode is active, because it's 3818 // Do not show the cursor line when Visual mode is active, because it's
3819 // not clear what is selected then. Do update w_last_cursorline. 3819 // not clear what is selected then. Do update w_last_cursorline.
3820 if (!(wp == curwin && VIsual_active)) 3820 if (!(wp == curwin && VIsual_active) && *wp->w_p_culopt != 'n')
3821 { 3821 {
3822 line_attr = HL_ATTR(HLF_CUL); 3822 line_attr = HL_ATTR(HLF_CUL);
3823 area_highlighting = TRUE; 3823 area_highlighting = TRUE;
3824 } 3824 }
3825 wp->w_last_cursorline = wp->w_cursor.lnum; 3825 wp->w_last_cursorline = wp->w_cursor.lnum;
4019 /* When 'cursorline' is set highlight the line number of 4019 /* When 'cursorline' is set highlight the line number of
4020 * the current line differently. 4020 * the current line differently.
4021 * TODO: Can we use CursorLine instead of CursorLineNr 4021 * TODO: Can we use CursorLine instead of CursorLineNr
4022 * when CursorLineNr isn't set? */ 4022 * when CursorLineNr isn't set? */
4023 if ((wp->w_p_cul || wp->w_p_rnu) 4023 if ((wp->w_p_cul || wp->w_p_rnu)
4024 && *wp->w_p_culopt != 'l'
4024 && lnum == wp->w_cursor.lnum) 4025 && lnum == wp->w_cursor.lnum)
4025 char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN)); 4026 char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN));
4026 #endif 4027 #endif
4027 } 4028 }
4028 } 4029 }
4053 # ifdef FEAT_DIFF 4054 # ifdef FEAT_DIFF
4054 if (diff_hlf != (hlf_T)0) 4055 if (diff_hlf != (hlf_T)0)
4055 { 4056 {
4056 char_attr = HL_ATTR(diff_hlf); 4057 char_attr = HL_ATTR(diff_hlf);
4057 # ifdef FEAT_SYN_HL 4058 # ifdef FEAT_SYN_HL
4058 if (wp->w_p_cul && lnum == wp->w_cursor.lnum) 4059 if (wp->w_p_cul && lnum == wp->w_cursor.lnum
4060 && *wp->w_p_culopt != 'n')
4059 char_attr = hl_combine_attr(char_attr, 4061 char_attr = hl_combine_attr(char_attr,
4060 HL_ATTR(HLF_CUL)); 4062 HL_ATTR(HLF_CUL));
4061 # endif 4063 # endif
4062 } 4064 }
4063 # endif 4065 # endif
4115 * required when 'linebreak' is also set. */ 4117 * required when 'linebreak' is also set. */
4116 if (tocol == vcol) 4118 if (tocol == vcol)
4117 tocol += n_extra; 4119 tocol += n_extra;
4118 #ifdef FEAT_SYN_HL 4120 #ifdef FEAT_SYN_HL
4119 /* combine 'showbreak' with 'cursorline' */ 4121 /* combine 'showbreak' with 'cursorline' */
4120 if (wp->w_p_cul && lnum == wp->w_cursor.lnum) 4122 if (wp->w_p_cul && lnum == wp->w_cursor.lnum
4123 && *wp->w_p_culopt != 'n')
4121 char_attr = hl_combine_attr(char_attr, 4124 char_attr = hl_combine_attr(char_attr,
4122 HL_ATTR(HLF_CUL)); 4125 HL_ATTR(HLF_CUL));
4123 #endif 4126 #endif
4124 } 4127 }
4125 # endif 4128 # endif
4210 diff_hlf = HLF_TXD; /* changed text */ 4213 diff_hlf = HLF_TXD; /* changed text */
4211 if (diff_hlf == HLF_TXD && ptr - line > change_end 4214 if (diff_hlf == HLF_TXD && ptr - line > change_end
4212 && n_extra == 0) 4215 && n_extra == 0)
4213 diff_hlf = HLF_CHD; /* changed line */ 4216 diff_hlf = HLF_CHD; /* changed line */
4214 line_attr = HL_ATTR(diff_hlf); 4217 line_attr = HL_ATTR(diff_hlf);
4215 if (wp->w_p_cul && lnum == wp->w_cursor.lnum) 4218 if (wp->w_p_cul && lnum == wp->w_cursor.lnum
4219 && *wp->w_p_culopt != 'n')
4216 line_attr = hl_combine_attr(line_attr, HL_ATTR(HLF_CUL)); 4220 line_attr = hl_combine_attr(line_attr, HL_ATTR(HLF_CUL));
4217 } 4221 }
4218 #endif 4222 #endif
4219 4223
4220 #ifdef FEAT_TEXT_PROP 4224 #ifdef FEAT_TEXT_PROP
5178 { 5182 {
5179 diff_hlf = HLF_CHD; 5183 diff_hlf = HLF_CHD;
5180 if (vi_attr == 0 || char_attr != vi_attr) 5184 if (vi_attr == 0 || char_attr != vi_attr)
5181 { 5185 {
5182 char_attr = HL_ATTR(diff_hlf); 5186 char_attr = HL_ATTR(diff_hlf);
5183 if (wp->w_p_cul && lnum == wp->w_cursor.lnum) 5187 if (wp->w_p_cul && lnum == wp->w_cursor.lnum
5188 && *wp->w_p_culopt != 'n')
5184 char_attr = hl_combine_attr(char_attr, 5189 char_attr = hl_combine_attr(char_attr,
5185 HL_ATTR(HLF_CUL)); 5190 HL_ATTR(HLF_CUL));
5186 } 5191 }
5187 } 5192 }
5188 # endif 5193 # endif