Merge pull request #23071 from luukvbaal/sloclater

fix: winbar is not redrawn on window change when 'showcmdloc' is "statusline"
This commit is contained in:
zeertzjq
2023-04-14 07:00:04 +08:00
committed by GitHub
2 changed files with 48 additions and 5 deletions

View File

@@ -1173,7 +1173,7 @@ static int normal_execute(VimState *state, int key)
msg_col = 0; msg_col = 0;
} }
s->old_pos = curwin->w_cursor; // remember where cursor was s->old_pos = curwin->w_cursor; // remember where the cursor was
// When 'keymodel' contains "startsel" some keys start Select/Visual // When 'keymodel' contains "startsel" some keys start Select/Visual
// mode. // mode.
@@ -1997,13 +1997,21 @@ static void display_showcmd(void)
showcmd_is_clear = (len == 0); showcmd_is_clear = (len == 0);
if (*p_sloc == 's') { if (*p_sloc == 's') {
win_redr_status(curwin); if (showcmd_is_clear) {
setcursor(); // put cursor back where it belongs curwin->w_redr_status = true;
} else {
win_redr_status(curwin);
setcursor(); // put cursor back where it belongs
}
return; return;
} }
if (*p_sloc == 't') { if (*p_sloc == 't') {
draw_tabline(); if (showcmd_is_clear) {
setcursor(); // put cursor back where it belongs redraw_tabline = true;
} else {
draw_tabline();
setcursor(); // put cursor back where it belongs
}
return; return;
} }
// 'showcmdloc' is "last" or empty // 'showcmdloc' is "last" or empty

View File

@@ -114,6 +114,41 @@ describe('winbar', function()
{2:[No Name] [No Name] }| {2:[No Name] [No Name] }|
| |
]]) ]])
-- 'showcmdloc' "statusline" should not interfere with winbar redrawing #23030
command('set showcmd showcmdloc=statusline')
feed('<C-W>w')
feed('<C-W>')
screen:expect([[
{6:Set Up The Bars }│{6:Set Up The Bars }|
│ |
{3:~ }│{3:~ }|
{3:~ }│{2:[No Name] }|
{3:~ }│{5:Set Up The Bars }|
{3:~ }│^ |
{3:~ }│{3:~ }|
{3:~ }│{4:[No Name] ^W }|
{3:~ }│{6:Set Up The Bars }|
{3:~ }│ |
{3:~ }│{3:~ }|
{2:[No Name] [No Name] }|
|
]])
feed('w<C-W>W')
screen:expect([[
{6:Set Up The Bars }│{6:Set Up The Bars }|
│ |
{3:~ }│{3:~ }|
{3:~ }│{2:[No Name] }|
{3:~ }│{5:Set Up The Bars }|
{3:~ }│^ |
{3:~ }│{3:~ }|
{3:~ }│{4:[No Name] }|
{3:~ }│{6:Set Up The Bars }|
{3:~ }│ |
{3:~ }│{3:~ }|
{2:[No Name] [No Name] }|
|
]])
end) end)
it('works when switching value of \'winbar\'', function() it('works when switching value of \'winbar\'', function()