diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-09-14 19:20:56 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-09-14 19:29:37 +0800 |
commit | 90585e47feb7b4c4d878ad32480e2fc09744a7ed (patch) | |
tree | db06a5c5dd5c204d0be4b4b331a9aca4ad716915 /src/nvim/drawline.c | |
parent | f2173b1aa2bec63aa982794ffde806090ab5b680 (diff) | |
download | rneovim-90585e47feb7b4c4d878ad32480e2fc09744a7ed.tar.gz rneovim-90585e47feb7b4c4d878ad32480e2fc09744a7ed.tar.bz2 rneovim-90585e47feb7b4c4d878ad32480e2fc09744a7ed.zip |
vim-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: vim/vim#15679
https://github.com/vim/vim/commit/86dc4f8b432233a01d022c3e71df53db58229713
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r-- | src/nvim/drawline.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index b5273a54ca..c85b9d2288 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -170,24 +170,22 @@ static void 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; + int width1 = wp->w_width_inner - cur_col_off; + int width2 = width1 + win_col_off2(wp); if (saved_w_virtcol == wp->w_virtcol && prev_wp == wp - && prev_col_off == cur_col_off) { + && prev_width1 == width1 && prev_width2 == width2) { *right_col = prev_right_col; *left_col = prev_left_col; return; } - width1 = wp->w_width_inner - cur_col_off; - width2 = width1 + win_col_off2(wp); - *left_col = 0; *right_col = width1; @@ -202,8 +200,9 @@ static void 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; } /// Put a single char from an UTF-8 buffer into a line buffer. |