screen: cleanup allocation, clearing and validation

grid_xx functions shouldn't randomly be called when the screen is not valid.
Nvim deterministically initializes a default screen early in main(), so the
default grid can be assumed to be allocated.
This commit is contained in:
Björn Linse
2019-02-07 13:05:25 +01:00
parent 6e9ea5adce
commit be8058cfe4
4 changed files with 17 additions and 35 deletions

View File

@@ -152,7 +152,7 @@ void update_topline(void)
// If there is no valid screen and when the window height is zero just use
// the cursor line.
if (!screen_valid(true) || curwin->w_height_inner == 0) {
if (!default_grid.chars || curwin->w_height_inner == 0) {
curwin->w_topline = curwin->w_cursor.lnum;
curwin->w_botline = curwin->w_topline;
curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP;