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:
Björn Linse
2019-01-25 18:44:29 +01:00
parent 80b75bc99a
commit 2ab70cb55c
22 changed files with 321 additions and 227 deletions

View File

@@ -1251,7 +1251,7 @@ int plines_win_nofill(
return 1;
}
if (wp->w_grid.Columns == 0) {
if (wp->w_width_inner == 0) {
return 1;
}
@@ -1261,8 +1261,8 @@ int plines_win_nofill(
}
const int lines = plines_win_nofold(wp, lnum);
if (winheight && lines > wp->w_grid.Rows) {
return wp->w_grid.Rows;
if (winheight && lines > wp->w_height_inner) {
return wp->w_height_inner;
}
return lines;
}
@@ -1292,7 +1292,7 @@ int plines_win_nofold(win_T *wp, linenr_T lnum)
/*
* Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
*/
width = wp->w_grid.Columns - win_col_off(wp);
width = wp->w_width_inner - win_col_off(wp);
if (width <= 0 || col > 32000) {
return 32000; // bigger than the number of screen columns
}
@@ -1318,7 +1318,7 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column)
if (!wp->w_p_wrap)
return lines + 1;
if (wp->w_grid.Columns == 0) {
if (wp->w_width_inner == 0) {
return lines + 1;
}
@@ -1341,7 +1341,7 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column)
}
// Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
int width = wp->w_grid.Columns - win_col_off(wp);
int width = wp->w_width_inner - win_col_off(wp);
if (width <= 0) {
return 9999;
}