Commit: patch 9.2.1038: CursorLineFold/Sign highlighting depends on 'cursorlineopt'

1 view
Skip to first unread message

Christian Brabandt

unread,
Sep 7, 2026, 4:00:19 PM (5 days ago) Sep 7
to vim...@googlegroups.com
patch 9.2.1038: CursorLineFold/Sign highlighting depends on 'cursorlineopt'

Commit: https://github.com/vim/vim/commit/1f8d3c44c5bd5a3d5032b3fc53e9d3aa1052583c
Author: Vrushali-Z <zampal...@gmail.com>
Date: Mon Sep 7 19:22:08 2026 +0000

patch 9.2.1038: CursorLineFold/Sign highlighting depends on 'cursorlineopt'

Problem: CursorLineFold and CursorLineSign are only applied when
'cursorlineopt' contains "number" or is "both"
(Evgeni Chasnovski).
Solution: Apply those groups whenever 'cursorline' is set, independent
of 'cursorlineopt' (Vrushali Zampalkar).

fixes: #20480
closes: #21112

Signed-off-by: Vrushali Zampalkar <vzam...@vzampalk-thinkpadt14gen5.punetw6.csb>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index e2d4f6e99..9529699c7 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 9.2. Last change: 2026 Aug 30
+*options.txt* For Vim version 9.2. Last change: 2026 Sep 07


VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3007,7 +3007,14 @@ A jump table for the options with a short description can be found at |Q_op|.
local to window
{not available when compiled without the |+syntax|
feature}
- Highlight the text line of the cursor with CursorLine |hl-CursorLine|.
+ Highlighting used for the line the cursor is on:
+
+ CursorLine the text line |hl-CursorLine|
+ CursorLineFold the fold column |hl-CursorLineFold|
+ CursorLineSign the sign column |hl-CursorLineSign|
+ CursorLineNr the line number, when 'cursorlineopt' contains
+ "number" |hl-CursorLineNr|
+
Useful to easily spot the cursor. Will make screen redrawing slower.
When Visual mode is active the highlighting isn't used to make it
easier to see the selected text.
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index e352e9c20..0f5bb70a9 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.2. Last change: 2026 Sep 01
+*version9.txt* For Vim version 9.2. Last change: 2026 Sep 07


VIM REFERENCE MANUAL by Bram Moolenaar
@@ -52712,6 +52712,8 @@ Changed ~
- fold functions take an optional {winid} parameter.
- It is no longer allowed to change the window layout during a |DiffUpdated|
autocommand.
+- The highlighting groups |hl-CursorLineFold| and |hl-CursorLineSign| are
+ always used when 'cursorline' is set.

*added-9.3*
Added ~
diff --git a/src/drawline.c b/src/drawline.c
index 00afb6409..f4470f558 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -223,14 +223,14 @@ typedef struct {

#if defined(FEAT_SIGNS) || defined(FEAT_FOLDING)
/*
- * Return TRUE if CursorLineSign highlight is to be used.
+ * Return TRUE if CursorLineSign / CursorLineFold highlight is to be used.
+ * This depends only on 'cursorline', not on 'cursorlineopt'.
*/
static int
use_cursor_line_highlight(win_T *wp, linenr_T lnum)
{
return wp->w_p_cul
- && lnum == wp->w_cursor.lnum
- && (wp->w_p_culopt_flags & CULOPT_NBR);
+ && lnum == wp->w_cursor.lnum;
}
#endif

diff --git a/src/testdir/test_cursorline.vim b/src/testdir/test_cursorline.vim
index 1aa04c3cb..a0fb500c4 100644
--- a/src/testdir/test_cursorline.vim
+++ b/src/testdir/test_cursorline.vim
@@ -106,6 +106,56 @@ func Test_cursorline_highlight2()
endtry
endfunc

+func Test_cursorline_fold_sign_independent_of_culopt()
+ " CursorLineFold/CursorLineSign follow 'cursorline', not 'cursorlineopt'.
+ CheckOption cursorlineopt
+ CheckFeature signs
+ CheckFeature folding
+
+ call s:test_windows(10, 20)
+ try
+ call setline(1, repeat(['aaaa'], 5))
+ setl number numberwidth=4 signcolumn=yes foldcolumn=1
+ hi FoldColumn ctermbg=1 guibg=Red
+ hi CursorLineFold ctermbg=2 guibg=Green
+ hi SignColumn ctermbg=3 guibg=Yellow
+ hi CursorLineSign ctermbg=4 guibg=Blue
+
+ setl nocursorline
+ redraw
+ let fold_off = screenattr(1, 1)
+ let sign_off = screenattr(1, 2)
+
+ " 'cursorlineopt' is "line" only: fold/sign on the cursor line still
+ " use CursorLineFold / CursorLineSign.
+ setl cursorline cursorlineopt=line
+ redraw
+ call assert_notequal(fold_off, screenattr(1, 1))
+ call assert_notequal(sign_off, screenattr(1, 2))
+ call assert_equal(fold_off, screenattr(2, 1))
+ call assert_equal(sign_off, screenattr(2, 2))
+
+ setl cursorlineopt=number
+ redraw
+ call assert_notequal(fold_off, screenattr(1, 1))
+ call assert_notequal(sign_off, screenattr(1, 2))
+
+ setl cursorlineopt=both
+ redraw
+ call assert_notequal(fold_off, screenattr(1, 1))
+ call assert_notequal(sign_off, screenattr(1, 2))
+ finally
+ setl number& numberwidth& signcolumn& foldcolumn& cursorline& cursorlineopt&
+ hi clear FoldColumn
+ hi clear CursorLineFold
+ hi clear SignColumn
+ hi clear CursorLineSign
+ hi default link CursorLineFold FoldColumn
+ hi default link CursorLineSign SignColumn
+ call s:close_windows()
+ endtry
+endfunc
+
func Test_cursorline_screenline()
CheckScreendump
CheckOption cursorlineopt
diff --git a/src/version.c b/src/version.c
index fea336665..14763ece9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1038,
/**/
1037,
/**/
Reply all
Reply to author
Forward
0 new messages