fix(ui): redraw winbar alongside statusline

Remove `w_redr_winbar` and use `w_redr_status` to redraw the winbar to
ensure that winbar redraw is triggered alongside the statusline redraw.
This commit is contained in:
Famiu Haque 2022-05-23 18:38:07 +06:00
parent 4c6626f03d
commit 353553f913
3 changed files with 15 additions and 59 deletions

View File

@ -1389,8 +1389,7 @@ struct window_S {
// w_redr_type is REDRAW_TOP
linenr_T w_redraw_top; // when != 0: first line needing redraw
linenr_T w_redraw_bot; // when != 0: last line needing redraw
bool w_redr_status; // if true status line must be redrawn
bool w_redr_winbar; // if true window bar must be redrawn
bool w_redr_status; // if true statusline/winbar must be redrawn
bool w_redr_border; // if true border must be redrawn
// remember what is shown in the ruler for this window (if 'ruler' set)

View File

@ -277,23 +277,14 @@ void redrawWinline(win_T *wp, linenr_T lnum)
void redraw_buf_status_later(buf_T *buf)
{
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_buffer != buf) {
continue;
}
bool redraw = false;
if (wp->w_status_height || (wp == curwin && global_stl_height())) {
if (wp->w_buffer == buf && (wp->w_status_height || (wp == curwin && global_stl_height())
|| wp->w_winbar_height)) {
wp->w_redr_status = true;
redraw = true;
}
if (wp->w_winbar_height) {
wp->w_redr_winbar = true;
redraw = true;
}
if (redraw && must_redraw < VALID) {
if (must_redraw < VALID) {
must_redraw = VALID;
}
}
}
}
void redraw_win_signcol(win_T *wp)
@ -397,9 +388,6 @@ int update_screen(int type)
if (wp->w_floating) {
continue;
}
if (wp->w_winrow + wp->w_winbar_height > valid) {
wp->w_redr_winbar = true;
}
if (W_ENDROW(wp) > valid) {
wp->w_redr_type = MAX(wp->w_redr_type, NOT_VALID);
}
@ -432,9 +420,6 @@ int update_screen(int type)
} else {
wp->w_redr_type = NOT_VALID;
if (wp->w_winrow + wp->w_winbar_height <= msg_scrolled) {
wp->w_redr_winbar = true;
}
if (!is_stl_global && W_ENDROW(wp) + wp->w_status_height <= msg_scrolled) {
wp->w_redr_status = true;
}
}
@ -590,10 +575,8 @@ int update_screen(int type)
// redraw status line and window bar after the window to minimize cursor movement
if (wp->w_redr_status) {
win_redr_status(wp);
}
if (wp->w_redr_winbar) {
win_redr_winbar(wp);
win_redr_status(wp);
}
}
@ -747,7 +730,6 @@ static void win_update(win_T *wp, DecorProviders *providers)
if (type >= NOT_VALID) {
wp->w_redr_status = true;
wp->w_redr_winbar = true;
wp->w_lines_valid = 0;
}
@ -4539,17 +4521,9 @@ void status_redraw_all(void)
bool is_stl_global = global_stl_height() != 0;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
bool redraw = false;
if ((!is_stl_global && wp->w_status_height) || (is_stl_global && wp == curwin)) {
if ((!is_stl_global && wp->w_status_height) || (is_stl_global && wp == curwin)
|| wp->w_winbar_height) {
wp->w_redr_status = true;
redraw = true;
}
if (wp->w_winbar_height) {
wp->w_redr_winbar = true;
redraw = true;
}
if (redraw) {
redraw_later(wp, VALID);
}
}
@ -4567,20 +4541,9 @@ void status_redraw_buf(buf_T *buf)
bool is_stl_global = global_stl_height() != 0;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_buffer != buf) {
continue;
}
bool redraw = false;
if ((!is_stl_global && wp->w_status_height) || (is_stl_global && wp == curwin)) {
if (wp->w_buffer == buf && ((!is_stl_global && wp->w_status_height)
|| (is_stl_global && wp == curwin) || wp->w_winbar_height)) {
wp->w_redr_status = true;
redraw = true;
}
if (wp->w_winbar_height) {
wp->w_redr_winbar = true;
redraw = true;
}
if (redraw) {
redraw_later(wp, VALID);
}
}
@ -4593,10 +4556,8 @@ void redraw_statuslines(void)
{
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_redr_status) {
win_redr_status(wp);
}
if (wp->w_redr_winbar) {
win_redr_winbar(wp);
win_redr_status(wp);
}
}
if (redraw_tabline) {
@ -5120,12 +5081,8 @@ static void win_redr_winbar(win_T *wp)
}
entered = true;
wp->w_redr_winbar = false;
if (wp->w_winbar_height == 0) {
// No window bar, do nothing.
} else if (!redrawing()) {
// Don't redraw right now, do it later.
wp->w_redr_winbar = true;
if (wp->w_winbar_height == 0 || !redrawing()) {
// Do nothing.
} else if (*p_wbr != NUL || *wp->w_p_wbr != NUL) {
int saved_did_emsg = did_emsg;

View File

@ -6709,7 +6709,7 @@ void set_winbar(void)
if (wp->w_winbar_height != winbar_height) {
wp->w_winbar_height = winbar_height;
win_set_inner_size(wp);
wp->w_redr_winbar = winbar_height;
wp->w_redr_status = wp->w_redr_status || winbar_height;
if (winbar_height == 0) {
// When removing winbar, deallocate the w_winbar_click_defs array