ref: ff216cb8e2b5228d506cac8155cdaa3f17192ed6
parent: 53b5cb4f63b5725d4a97592abb3ab3316a4bf466
author: cancel <cancel@cancel.fm>
date: Thu Jan 2 17:52:05 EST 2020
Fix potentially non-updating window when 0-margin
--- a/tui_main.c
+++ b/tui_main.c
@@ -1217,6 +1217,9 @@
void ged_set_window_size(Ged* a, int win_h, int win_w) {
bool draw_hud = win_h > Hud_height + 1;
int grid_h = draw_hud ? win_h - 2 : win_h;
+ if (a->win_h == win_h && a->win_w == win_w && a->grid_h == grid_h &&
+ a->is_hud_visible == draw_hud)
+ return;
a->win_h = win_h;
a->win_w = win_w;
a->grid_h = grid_h;
@@ -2427,7 +2430,9 @@
content_w -= margins_2;
}
if (cont_window == NULL || getmaxy(cont_window) != content_h ||
- getmaxx(cont_window) != content_w) {
+ getmaxx(cont_window) != content_w ||
+ getbegy(cont_window) != content_y ||
+ getbegx(cont_window) != content_x) {
if (cont_window) {
delwin(cont_window);
}
@@ -2434,8 +2439,13 @@
wclear(stdscr);
cont_window =
derwin(stdscr, content_h, content_w, content_y, content_x);
- ged_set_window_size(&ged_state, content_h, content_w);
+ ged_state.is_draw_dirty = true;
}
+ // OK to call this unconditionally -- deriving the sub-window areas is
+ // more than a single comparison, and we don't want to split up or
+ // duplicate the math and checks for it, so this routine will calculate
+ // the stuff it needs to and then early-out if there's no further work.
+ ged_set_window_size(&ged_state, content_h, content_w);
goto next_getch;
}
#ifndef FEAT_NOMOUSE