]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0530: WinBar row vertical separator not refreshed on window change master v9.2.0530
authorHirohito Higashi <h.east.727@gmail.com>
Sun, 24 May 2026 17:43:32 +0000 (17:43 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 24 May 2026 17:43:32 +0000 (17:43 +0000)
Problem:  After the current window changes, the vertical separator cell
          on the WinBar row keeps its previous VertSplit / VertSplitNC
          highlight.  Content rows and status line rows of the same
          window are refreshed correctly; only the WinBar row is left
          behind, so the WinBar's separator no longer matches the
          surrounding cells (Mao-Yining)
Solution: Include the WinBar row in draw_vsep_win() when redrawing
          from the top of the window.  When called with row == 0 the
          loop now starts at wp->w_winrow (the WinBar row when present)
          instead of W_WINROW(wp) (the content start), so the separator
          highlight on the WinBar row is updated together with the rest
          of the window (Hirohito Higashi).

fixes:  #20304
closes: #20310

Co-Authored-By: Claude Opus 4.7 (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_winbar_vsep_active.dump [new file with mode: 0644]
src/testdir/dumps/Test_winbar_vsep_inactive.dump [new file with mode: 0644]
src/testdir/test_winbar.vim
src/version.c

index 8c1b8da0a723e9ea05f2d552dac8803d8799a8f8..9042d90ded3b4c354749216e2683a59bf20d4cba 100644 (file)
@@ -1222,8 +1222,11 @@ draw_vsep_win(win_T *wp, int row)
 
     int content_end = W_WINROW(wp) + wp->w_height;
 
-    // Content rows: VertSplit/VertSplitNC based on adjacency.
-    for (int r = W_WINROW(wp) + row; r < content_end; ++r)
+    // Content rows: VertSplit/VertSplitNC based on adjacency.  Include the
+    // WinBar row (above the content) when redrawing from the top so that
+    // the separator highlight is updated on current-window changes.
+    int start_row = (row == 0) ? wp->w_winrow : W_WINROW(wp) + row;
+    for (int r = start_row; r < content_end; ++r)
     {
        int hl;
        int c = fillchar_vsep(&hl, wp, r);
diff --git a/src/testdir/dumps/Test_winbar_vsep_active.dump b/src/testdir/dumps/Test_winbar_vsep_active.dump
new file mode 100644 (file)
index 0000000..9a0e234
--- /dev/null
@@ -0,0 +1,20 @@
+| +0&#ffffff0@19||+0#000000255&| +0#0000000&@18||+0#000000255&| +0#0000000&@18
+|~+0#4040ff13&| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+0#000000255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|<+1#0000000&|N|o| |N|a|m|e|]| |0|,|0|-|1| @1|A|l@1| |<|N|o| |N|a|m|e|]| |0|,|0|-|1| |A|l@1| |<|N|o| |N|a|m|e|]| |0|,|0|-|1| |A|l@1
+| +0&#e0e0e08| +2#ffffff16#6c6c6c255|S|t|e|p| | +0#0000000#e0e0e08@1| +2#ffffff16#6c6c6c255|N|e|x|t| | +0#0000000#e0e0e08@1| +2#ffffff16#6c6c6c255|F|i|n|i|s|h| | +0#0000000#e0e0e08@1| +2#ffffff16#6c6c6c255|C|o||+1#87afff255#ffffff0| +0#0000000&@28
+> @29||+1#87afff255&|~+0#4040ff13&| @27
+|~| @28||+1#87afff255&|~+0#4040ff13&| @27
+|~| @28||+1#87afff255&|~+0#4040ff13&| @27
+|~| @28||+1#87afff255&|~+0#4040ff13&| @27
+|~| @28||+1#87afff255&|~+0#4040ff13&| @27
+|~| @28||+1#87afff255&|~+0#4040ff13&| @27
+|~| @28||+1#87afff255&|~+0#4040ff13&| @27
+|[+3#0000000&|N|o| |N|a|m|e|]| @5|0|,|0|-|1| @6|A|l@1| |[+1&&|N|o| |N|a|m|e|]| @5|0|,|0|-|1| @5|A|l@1
+| +0&&@59
diff --git a/src/testdir/dumps/Test_winbar_vsep_inactive.dump b/src/testdir/dumps/Test_winbar_vsep_inactive.dump
new file mode 100644 (file)
index 0000000..2e6f17f
--- /dev/null
@@ -0,0 +1,20 @@
+> +0&#ffffff0@19||+1#87afff255&| +0#0000000&@18||+0#000000255&| +0#0000000&@18
+|~+0#4040ff13&| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|~| @18||+1#87afff255&|~+0#4040ff13&| @17||+0#000000255&|~+0#4040ff13&| @17
+|<+3#0000000&|N|o| |N|a|m|e|]| |0|,|0|-|1| @1|A|l@1| |<+1&&|N|o| |N|a|m|e|]| |0|,|0|-|1| |A|l@1| |<|N|o| |N|a|m|e|]| |0|,|0|-|1| |A|l@1
+| +0&#e0e0e08| +2#ffffff16#6c6c6c255|S|t|e|p| | +0#0000000#e0e0e08@1| +2#ffffff16#6c6c6c255|N|e|x|t| | +0#0000000#e0e0e08@1| +2#ffffff16#6c6c6c255|F|i|n|i|s|h| | +0#0000000#e0e0e08@1| +2#ffffff16#6c6c6c255|C|o||+0#000000255#ffffff0| +0#0000000&@28
+@30||+0#000000255&|~+0#4040ff13&| @27
+|~| @28||+0#000000255&|~+0#4040ff13&| @27
+|~| @28||+0#000000255&|~+0#4040ff13&| @27
+|~| @28||+0#000000255&|~+0#4040ff13&| @27
+|~| @28||+0#000000255&|~+0#4040ff13&| @27
+|~| @28||+0#000000255&|~+0#4040ff13&| @27
+|~| @28||+0#000000255&|~+0#4040ff13&| @27
+|[+1#0000000&|N|o| |N|a|m|e|]| @5|0|,|0|-|1| @6|A|l@1| |[|N|o| |N|a|m|e|]| @5|0|,|0|-|1| @5|A|l@1
+| +0&&@59
index 59241746b972c8ae2f418fdb1cc9710aca61c81c..3a9ca68e8dd04d5c4395e714a8c3aaf42ca4ede9 100644 (file)
@@ -157,6 +157,36 @@ func Test_winbar_not_visible_custom_statusline()
   call StopVimInTerminal(buf)
 endfunction
 
+" The vertical separator on the WinBar row must follow VertSplit/VertSplitNC
+" when the current window changes.
+func Test_winbar_vsep_highlight_after_focus_change()
+  CheckScreendump
+
+  let lines =<< trim END
+      vim9script
+      wincmd s
+      wincmd v
+      wincmd v
+      wincmd j
+      wincmd v
+      nnoremenu 1.10 WinBar.Step :Step<CR>
+      nnoremenu 1.20 WinBar.Next :Next<CR>
+      nnoremenu 1.30 WinBar.Finish :Finish<CR>
+      nnoremenu 1.40 WinBar.Cont :Continue<CR>
+      hi Vertsplit term=reverse ctermfg=111
+      hi VertsplitNC term=reverse ctermfg=16
+  END
+  call writefile(lines, 'XtestWinbarVsep', 'D')
+  let buf = RunVimInTerminal('-S XtestWinbarVsep', #{rows: 20, cols: 60})
+
+  call VerifyScreenDump(buf, 'Test_winbar_vsep_active', {})
+
+  call term_sendkeys(buf, "\<C-W>k")
+  call VerifyScreenDump(buf, 'Test_winbar_vsep_inactive', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_drag_statusline_with_winbar()
   call SetupWinbar()
   let save_mouse = &mouse
index ca5b3ec12ff28582be9c3f980623982e1aa03da4..ca41d42a53789c23fe47c69f45c4b108a9b1d582 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    530,
 /**/
     529,
 /**/