diff options
Diffstat (limited to 'src/nvim/drawscreen.c')
-rw-r--r-- | src/nvim/drawscreen.c | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index e645d1bbea..0961aabf21 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -290,9 +290,23 @@ void screen_resize(int width, int height) Rows = height; Columns = width; check_screensize(); - int max_p_ch = Rows - min_rows() + 1; - if (!ui_has(kUIMessages) && p_ch > 0 && p_ch > max_p_ch) { - p_ch = max_p_ch ? max_p_ch : 1; + if (!ui_has(kUIMessages)) { + // clamp 'cmdheight' + int max_p_ch = Rows - min_rows(curtab) + 1; + if (p_ch > 0 && p_ch > max_p_ch) { + p_ch = MAX(max_p_ch, 1); + curtab->tp_ch_used = p_ch; + } + // clamp 'cmdheight' for other tab pages + FOR_ALL_TABS(tp) { + if (tp == curtab) { + continue; // already set above + } + int max_tp_ch = Rows - min_rows(tp) + 1; + if (tp->tp_ch_used > 0 && tp->tp_ch_used > max_tp_ch) { + tp->tp_ch_used = MAX(max_tp_ch, 1); + } + } } height = Rows; width = Columns; @@ -396,7 +410,7 @@ void check_screensize(void) { // Limit Rows and Columns to avoid an overflow in Rows * Columns. // need room for one window and command line - Rows = MIN(MAX(Rows, min_rows()), 1000); + Rows = MIN(MAX(Rows, min_rows_for_all_tabpages()), 1000); Columns = MIN(MAX(Columns, MIN_COLUMNS), 10000); } @@ -665,6 +679,10 @@ int update_screen(void) updating_screen = false; + if (need_maketitle) { + maketitle(); + } + // Clear or redraw the command line. Done last, because scrolling may // mess up the command line. if (clear_cmdline || redraw_cmdline || redraw_mode) { @@ -842,6 +860,19 @@ void setcursor_mayforce(win_T *wp, bool force) } } +/// Mark the title and icon for redraw if either of them uses statusline format. +/// +/// @return whether either title or icon uses statusline format. +bool redraw_custom_title_later(void) +{ + if ((p_icon && (stl_syntax & STL_IN_ICON)) + || (p_title && (stl_syntax & STL_IN_TITLE))) { + need_maketitle = true; + return true; + } + return false; +} + /// Show current cursor info in ruler and various other places /// /// @param always if false, only show ruler if position has changed. @@ -875,10 +906,7 @@ void show_cursor_info_later(bool force) curwin->w_redr_status = true; } - if ((p_icon && (stl_syntax & STL_IN_ICON)) - || (p_title && (stl_syntax & STL_IN_TITLE))) { - need_maketitle = true; - } + redraw_custom_title_later(); } curwin->w_stl_cursor = curwin->w_cursor; @@ -1502,10 +1530,12 @@ static void win_update(win_T *wp) decor_providers_invoke_win(wp); - if (win_redraw_signcols(wp)) { - wp->w_lines_valid = 0; - wp->w_redr_type = UPD_NOT_VALID; - changed_line_abv_curs_win(wp); + FOR_ALL_WINDOWS_IN_TAB(win, curtab) { + if (win->w_buffer == wp->w_buffer && win_redraw_signcols(win)) { + win->w_lines_valid = 0; + changed_line_abv_curs_win(win); + redraw_later(win, UPD_NOT_VALID); + } } init_search_hl(wp, &screen_search_hl); @@ -2757,6 +2787,10 @@ void redraw_statuslines(void) if (redraw_tabline) { draw_tabline(); } + + if (need_maketitle) { + maketitle(); + } } /// Redraw all status lines at the bottom of frame "frp". |