mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
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
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user