diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-01-25 18:44:29 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-01-27 12:07:06 +0100 |
commit | 2ab70cb55c80b17fb4100dd7f2d056131c02b08b (patch) | |
tree | e3a4cc06776b51d1ec4e9733d377452d0158b4c3 /src/nvim/screen.c | |
parent | 80b75bc99aeb6ecc40e59343ec527443d882e8ec (diff) | |
download | rneovim-2ab70cb55c80b17fb4100dd7f2d056131c02b08b.tar.gz rneovim-2ab70cb55c80b17fb4100dd7f2d056131c02b08b.tar.bz2 rneovim-2ab70cb55c80b17fb4100dd7f2d056131c02b08b.zip |
window/ui: reorganize size variables, fix terminal window size with multigrid.
wp->w_height_inner now contains the "inner" size, regardless if the
window has been drawn yet or not. It should be used instead of
wp->w_grid.Rows, for stuff that is not directly related to accessing
the allocated grid memory, such like cursor movement and terminal size
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index d5a48cebf9..bb69a13db0 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -5898,15 +5898,8 @@ void win_grid_alloc(win_T *wp) { ScreenGrid *grid = &wp->w_grid; - int rows = grid->requested_rows; - if (rows == 0) { - rows = wp->w_height; - } - - int columns = grid->requested_cols; - if (columns == 0) { - columns = wp->w_width; - } + int rows = wp->w_height_inner; + int cols = wp->w_width_inner; // TODO(bfredl): floating windows should force this to true bool want_allocation = ui_is_external(kUIMultigrid); @@ -5919,9 +5912,9 @@ void win_grid_alloc(win_T *wp) int was_resized = false; if ((has_allocation != want_allocation) || grid->Rows != rows - || grid->Columns != columns) { + || grid->Columns != cols) { if (want_allocation) { - grid_alloc(grid, rows, columns, true); + grid_alloc(grid, rows, cols, true); win_free_lsize(wp); win_alloc_lines(wp); } else { @@ -5929,7 +5922,7 @@ void win_grid_alloc(win_T *wp) // Only keep track of the size and offset of the window. grid_free(grid); grid->Rows = rows; - grid->Columns = columns; + grid->Columns = cols; } was_resized = true; } @@ -6233,7 +6226,7 @@ void setcursor(void) if (curwin->w_p_rl) { // With 'rightleft' set and the cursor on a double-wide character, // position it on the leftmost column. - col = curwin->w_grid.Columns - curwin->w_wcol + col = curwin->w_width_inner - curwin->w_wcol - ((utf_ptr2cells(get_cursor_pos_ptr()) == 2 && vim_isprintc(gchar_cursor())) ? 2 : 1); } @@ -7086,7 +7079,7 @@ int number_width(win_T *wp) if (wp->w_p_rnu && !wp->w_p_nu) { // cursor line shows "0" - lnum = wp->w_grid.Rows; + lnum = wp->w_height_inner; } else { // cursor line shows absolute line number lnum = wp->w_buffer->b_ml.ml_line_count; |