diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/main.c | 2 | ||||
-rw-r--r-- | src/nvim/message.c | 6 | ||||
-rw-r--r-- | src/nvim/move.c | 2 | ||||
-rw-r--r-- | src/nvim/screen.c | 42 |
4 files changed, 17 insertions, 35 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 5d67f53ec4..c0dea196fb 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -300,7 +300,7 @@ int main(int argc, char **argv) assert(p_ch >= 0 && Rows >= p_ch && Rows - p_ch <= INT_MAX); cmdline_row = (int)(Rows - p_ch); msg_row = cmdline_row; - screenalloc(false); // allocate screen buffers + screenalloc(); // allocate screen buffers set_init_2(headless_mode); TIME_MSG("inits 2"); diff --git a/src/nvim/message.c b/src/nvim/message.c index b4f50c81a2..971a14974c 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -946,9 +946,9 @@ void wait_return(int redraw) c = CAR; /* no need for a return in ex mode */ got_int = FALSE; } else { - /* Make sure the hit-return prompt is on screen when 'guioptions' was - * just changed. */ - screenalloc(false); + // Make sure the hit-return prompt is on screen when 'guioptions' was + // just changed. + screenalloc(); State = HITRETURN; setmouse(); diff --git a/src/nvim/move.c b/src/nvim/move.c index 869b877b02..7aa7f922c1 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -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; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index ffd8cc04c4..aa2982ec0c 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -274,9 +274,10 @@ void update_screen(int type) static int did_intro = FALSE; int did_one; - /* Don't do anything if the screen structures are (not yet) valid. */ - if (!screen_valid(TRUE)) + // Don't do anything if the screen structures are (not yet) valid. + if (!default_grid.chars) { return; + } if (must_redraw) { if (type < must_redraw) /* use maximal type */ @@ -5804,7 +5805,7 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col, } // nothing to do - if (grid->chars == NULL || start_row >= end_row || start_col >= end_col) { + if (start_row >= end_row || start_col >= end_col) { return; } @@ -5893,18 +5894,6 @@ void check_for_delay(int check_msg_scroll) } } -/* - * screen_valid - allocate screen buffers if size changed - * If "doclear" is TRUE: clear screen if it has been resized. - * Returns TRUE if there is a valid screen to write to. - * Returns FALSE when starting up and screen not initialized yet. - */ -int screen_valid(int doclear) -{ - screenalloc(doclear); // allocate screen buffers if size changed - return default_grid.chars != NULL; -} - /// (Re)allocates a window grid if size changed while in ext_multigrid mode. /// Updates size, offsets and handle for the grid regardless. /// @@ -5980,7 +5969,7 @@ void grid_assign_handle(ScreenGrid *grid) /// default_grid.Columns to access items in default_grid.chars[]. Use Rows /// and Columns for positioning text etc. where the final size of the shell is /// needed. -void screenalloc(bool doclear) +void screenalloc(void) { static bool entered = false; // avoid recursiveness int retry_count = 0; @@ -6032,7 +6021,7 @@ retry: // Continuing with the old arrays may result in a crash, because the // size is wrong. - grid_alloc(&default_grid, Rows, Columns, !doclear, true); + grid_alloc(&default_grid, Rows, Columns, true, true); StlClickDefinition *new_tab_page_click_defs = xcalloc( (size_t)Columns, sizeof(*new_tab_page_click_defs)); @@ -6046,10 +6035,7 @@ retry: default_grid.col_offset = 0; default_grid.handle = DEFAULT_GRID_HANDLE; - must_redraw = CLEAR; /* need to clear the screen later */ - if (doclear) - screenclear2(); - + must_redraw = CLEAR; // need to clear the screen later entered = FALSE; --RedrawingDisabled; @@ -6156,13 +6142,9 @@ void clear_tab_page_click_defs(StlClickDefinition *const tpcd, void screenclear(void) { - check_for_delay(FALSE); - screenalloc(false); /* allocate screen buffers if size changed */ - screenclear2(); /* clear the screen */ -} + check_for_delay(false); + screenalloc(); // allocate screen buffers if size changed -static void screenclear2(void) -{ int i; if (starting == NO_SCREEN || default_grid.chars == NULL) { @@ -6309,7 +6291,7 @@ void grid_ins_lines(ScreenGrid *grid, int row, int line_count, int end, int col, row += row_off; end += row_off; - if (!screen_valid(true) || line_count <= 0) { + if (line_count <= 0) { return; } @@ -6359,7 +6341,7 @@ void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col, row += row_off; end += row_off; - if (!screen_valid(true) || line_count <= 0) { + if (line_count <= 0) { return; } @@ -7159,7 +7141,7 @@ void screen_resize(int width, int height) */ if (State == ASKMORE || State == EXTERNCMD || State == CONFIRM || exmode_active) { - screenalloc(false); + screenalloc(); repeat_message(); } else { if (curwin->w_p_scb) |