]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0359: wrong VertSplitNC highlighting on winbar v9.2.0359
authorHirohito Higashi <h.east.727@gmail.com>
Thu, 16 Apr 2026 20:12:08 +0000 (20:12 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 16 Apr 2026 20:12:08 +0000 (20:12 +0000)
Problem:  wrong VertSplitNC highlighting on winbar
          (Maxim Kim, after v9.2.0349)
Solution: Use VertSplit instead of VertSplitNC for winbar rows
          (Hirohito Higashi).

vsep_row_is_curwin() and right_neighbor_at_row() used W_WINROW() which
excludes winbar rows from the window's range.  This caused the vertical
separator at winbar rows to use VertSplitNC even when curwin is adjacent.

Use w_winrow directly so winbar rows are included in the range check.

fixes:  #19985
closes: #19987

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/screen.c
src/testdir/dumps/Test_VertSplitNC_winbar_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_VertSplitNC_winbar_2.dump [new file with mode: 0644]
src/testdir/test_highlight.vim
src/version.c

index 8005b3cc336c88c1d9f0f68825d8a8587eb8a51b..eb7cc9cdd1176830e8fd746fcec6f719b347f6b6 100644 (file)
@@ -5129,9 +5129,9 @@ vsep_row_is_curwin(win_T *wp, int row)
        return true;
 
     // Check if curwin is immediately to the right of wp's separator and
-    // "row" is within curwin's row range.
+    // "row" is within curwin's row range (including the winbar).
     if (curwin->w_wincol == W_ENDCOL(wp) + wp->w_vsep_width
-           && row >= W_WINROW(curwin)
+           && row >= curwin->w_winrow
            && row < W_WINROW(curwin) + curwin->w_height)
        return true;
 
@@ -5173,7 +5173,7 @@ right_neighbor_at_row(win_T *wp, int row)
 
     FOR_ALL_WINDOWS(rn)
        if (rn->w_wincol == rcol
-               && row >= W_WINROW(rn)
+               && row >= rn->w_winrow
                && row < W_WINROW(rn) + rn->w_height + rn->w_status_height)
            return rn;
     return NULL;
diff --git a/src/testdir/dumps/Test_VertSplitNC_winbar_1.dump b/src/testdir/dumps/Test_VertSplitNC_winbar_1.dump
new file mode 100644 (file)
index 0000000..4fbee46
--- /dev/null
@@ -0,0 +1,12 @@
+|w+0&#ffffff0|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&| +0#0000000#e0e0e08| +2#ffffff16#6c6c6c255|I|t|e|m| | +0#0000000#e0e0e08@29
+|w+0&#ffffff0|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&>w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|[+0#0000001#a8a8a8255|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p| +0#ffffff16#0000e05|[|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p
+| +0#0000000#ffffff0@74
diff --git a/src/testdir/dumps/Test_VertSplitNC_winbar_2.dump b/src/testdir/dumps/Test_VertSplitNC_winbar_2.dump
new file mode 100644 (file)
index 0000000..7653283
--- /dev/null
@@ -0,0 +1,12 @@
+>w+0&#ffffff0|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&| +0#0000000#e0e0e08| +2#ffffff16#6c6c6c255|I|t|e|m| | +0#0000000#e0e0e08@29
+|w+0&#ffffff0|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|w|i|n|b|a|r| |t|e|s|t| @25||+0#40ff4011&|w+0#0000000&|i|n|b|a|r| |t|e|s|t| @25
+|[+0#ffffff16#0000e05|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p| |[+0#0000001#a8a8a8255|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p
+| +0#0000000#ffffff0@74
index 6968e72b6a11d91580c853544aac9777d57b7cf1..ef593b8b358dbbc798fb18f29698608e938507c8 100644 (file)
@@ -1812,4 +1812,36 @@ func Test_VertSplitNC_winhighlight()
   call StopVimInTerminal(buf)
 endfunc
 
+" Test that VertSplit (not VertSplitNC) is used for the separator rows
+" adjacent to a window with a winbar.
+func Test_VertSplitNC_winbar()
+  CheckScreendump
+
+  let lines =<< trim END
+    hi StatusLine ctermfg=White ctermbg=DarkBlue cterm=NONE
+    hi StatusLineNC ctermfg=Black ctermbg=Gray cterm=NONE
+    hi VertSplit ctermfg=Green ctermbg=NONE cterm=NONE
+    hi VertSplitNC ctermfg=DarkGray ctermbg=NONE cterm=NONE
+    call setline(1, repeat(['winbar test'], 20))
+    vsplit
+    wincmd w
+    nnoremenu 1.10 WinBar.Item :echo 'test'<CR>
+  END
+  call writefile(lines, 'Xtest_vertsplitNC_winbar', 'D')
+
+  let buf = RunVimInTerminal('-S Xtest_vertsplitNC_winbar', {'rows': 12})
+  call TermWait(buf)
+
+  " Right window (with winbar) is current: the separator should use
+  " VertSplit for all rows including the winbar row.
+  call VerifyScreenDump(buf, 'Test_VertSplitNC_winbar_1', {})
+
+  " Move to left window: the separator should use VertSplitNC.
+  call term_sendkeys(buf, "\<C-W>h")
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_VertSplitNC_winbar_2', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index a836743b7abaa51edbb5d2d8097ef0b26a598a6f..b015465ed522bc48bac2f1b7a1c89de0edf5f8d5 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    359,
 /**/
     358,
 /**/