mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09: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:
@@ -3875,14 +3875,14 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
|
||||
|
||||
col_off1 = curwin_col_off();
|
||||
col_off2 = col_off1 - curwin_col_off2();
|
||||
width1 = curwin->w_grid.Columns - col_off1;
|
||||
width2 = curwin->w_grid.Columns - col_off2;
|
||||
width1 = curwin->w_width_inner - col_off1;
|
||||
width2 = curwin->w_width_inner - col_off2;
|
||||
|
||||
if (width2 == 0) {
|
||||
width2 = 1; // Avoid divide by zero.
|
||||
}
|
||||
|
||||
if (curwin->w_grid.Columns != 0) {
|
||||
if (curwin->w_width_inner != 0) {
|
||||
// Instead of sticking at the last character of the buffer line we
|
||||
// try to stick in the last column of the screen.
|
||||
if (curwin->w_curswant == MAXCOL) {
|
||||
@@ -4226,7 +4226,7 @@ dozet:
|
||||
|
||||
/* "zH" - scroll screen right half-page */
|
||||
case 'H':
|
||||
cap->count1 *= curwin->w_grid.Columns / 2;
|
||||
cap->count1 *= curwin->w_width_inner / 2;
|
||||
FALLTHROUGH;
|
||||
|
||||
/* "zh" - scroll screen to the right */
|
||||
@@ -4242,7 +4242,7 @@ dozet:
|
||||
break;
|
||||
|
||||
// "zL" - scroll screen left half-page
|
||||
case 'L': cap->count1 *= curwin->w_grid.Columns / 2;
|
||||
case 'L': cap->count1 *= curwin->w_width_inner / 2;
|
||||
FALLTHROUGH;
|
||||
|
||||
/* "zl" - scroll screen to the left */
|
||||
@@ -4278,7 +4278,7 @@ dozet:
|
||||
col = 0; /* like the cursor is in col 0 */
|
||||
else
|
||||
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);
|
||||
n = curwin->w_grid.Columns - curwin_col_off();
|
||||
n = curwin->w_width_inner - curwin_col_off();
|
||||
if (col + l_p_siso < n) {
|
||||
col = 0;
|
||||
} else {
|
||||
@@ -4989,7 +4989,7 @@ static void nv_scroll(cmdarg_T *cap)
|
||||
used -= diff_check_fill(curwin, curwin->w_topline)
|
||||
- curwin->w_topfill;
|
||||
validate_botline(); // make sure w_empty_rows is valid
|
||||
half = (curwin->w_grid.Rows - curwin->w_empty_rows + 1) / 2;
|
||||
half = (curwin->w_height_inner - curwin->w_empty_rows + 1) / 2;
|
||||
for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; n++) {
|
||||
// Count half he number of filler lines to be "below this
|
||||
// line" and half to be "above the next line".
|
||||
@@ -5004,7 +5004,7 @@ static void nv_scroll(cmdarg_T *cap)
|
||||
if (hasFolding(curwin->w_topline + n, NULL, &lnum))
|
||||
n = lnum - curwin->w_topline;
|
||||
}
|
||||
if (n > 0 && used > curwin->w_grid.Rows) {
|
||||
if (n > 0 && used > curwin->w_height_inner) {
|
||||
n--;
|
||||
}
|
||||
} else { // (cap->cmdchar == 'H')
|
||||
@@ -6716,9 +6716,9 @@ static void nv_g_cmd(cmdarg_T *cap)
|
||||
oap->motion_type = kMTCharWise;
|
||||
oap->inclusive = false;
|
||||
if (curwin->w_p_wrap
|
||||
&& curwin->w_grid.Columns != 0
|
||||
&& curwin->w_width_inner != 0
|
||||
) {
|
||||
int width1 = curwin->w_grid.Columns - curwin_col_off();
|
||||
int width1 = curwin->w_width_inner - curwin_col_off();
|
||||
int width2 = width1 + curwin_col_off2();
|
||||
|
||||
validate_virtcol();
|
||||
@@ -6731,7 +6731,7 @@ static void nv_g_cmd(cmdarg_T *cap)
|
||||
* 'relativenumber' is on and lines are wrapping the middle can be more
|
||||
* to the left. */
|
||||
if (cap->nchar == 'm') {
|
||||
i += (curwin->w_grid.Columns - curwin_col_off()
|
||||
i += (curwin->w_width_inner - curwin_col_off()
|
||||
+ ((curwin->w_p_wrap && i > 0)
|
||||
? curwin_col_off2() : 0)) / 2;
|
||||
}
|
||||
@@ -6778,11 +6778,11 @@ static void nv_g_cmd(cmdarg_T *cap)
|
||||
oap->motion_type = kMTCharWise;
|
||||
oap->inclusive = true;
|
||||
if (curwin->w_p_wrap
|
||||
&& curwin->w_grid.Columns != 0
|
||||
&& curwin->w_width_inner != 0
|
||||
) {
|
||||
curwin->w_curswant = MAXCOL; /* so we stay at the end */
|
||||
if (cap->count1 == 1) {
|
||||
int width1 = curwin->w_grid.Columns - col_off;
|
||||
int width1 = curwin->w_width_inner - col_off;
|
||||
int width2 = width1 + curwin_col_off2();
|
||||
|
||||
validate_virtcol();
|
||||
@@ -6808,7 +6808,7 @@ static void nv_g_cmd(cmdarg_T *cap)
|
||||
} else if (nv_screengo(oap, FORWARD, cap->count1 - 1) == false)
|
||||
clearopbeep(oap);
|
||||
} else {
|
||||
i = curwin->w_leftcol + curwin->w_grid.Columns - col_off - 1;
|
||||
i = curwin->w_leftcol + curwin->w_width_inner - col_off - 1;
|
||||
coladvance((colnr_T)i);
|
||||
|
||||
/* Make sure we stick in this column. */
|
||||
@@ -7918,7 +7918,7 @@ static void get_op_vcol(
|
||||
colnr_T end;
|
||||
|
||||
if (VIsual_mode != Ctrl_V
|
||||
|| (!initial && oap->end.col < curwin->w_grid.Columns)) {
|
||||
|| (!initial && oap->end.col < curwin->w_width_inner)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user