0
0
mirror of https://github.com/vim/vim.git synced 2025-10-17 07:44:28 -04:00

patch 9.1.0729: Wrong cursor-screenline when resizing window

Problem:  Wrong cursor-screenline when resizing window
Solution: Invalidate saved left_col and right_col when width1 or width2
          change.

closes: #15679

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-09-14 10:37:17 +02:00
committed by Christian Brabandt
parent be4bd189d2
commit 86dc4f8b43
6 changed files with 56 additions and 7 deletions

View File

@@ -39,25 +39,26 @@ margin_columns_win(win_T *wp, int *left_col, int *right_col)
// cache previous calculations depending on w_virtcol
static int saved_w_virtcol;
static win_T *prev_wp;
static int prev_width1;
static int prev_width2;
static int prev_left_col;
static int prev_right_col;
static int prev_col_off;
int cur_col_off = win_col_off(wp);
int width1;
int width2;
if (saved_w_virtcol == wp->w_virtcol
&& prev_wp == wp && prev_col_off == cur_col_off)
width1 = wp->w_width - cur_col_off;
width2 = width1 + win_col_off2(wp);
if (saved_w_virtcol == wp->w_virtcol && prev_wp == wp
&& prev_width1 == width1 && prev_width2 == width2)
{
*right_col = prev_right_col;
*left_col = prev_left_col;
return;
}
width1 = wp->w_width - cur_col_off;
width2 = width1 + win_col_off2(wp);
*left_col = 0;
*right_col = width1;
@@ -70,8 +71,9 @@ margin_columns_win(win_T *wp, int *left_col, int *right_col)
prev_left_col = *left_col;
prev_right_col = *right_col;
prev_wp = wp;
prev_width1 = width1;
prev_width2 = width2;
saved_w_virtcol = wp->w_virtcol;
prev_col_off = cur_col_off;
}
#endif