diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-09-14 19:51:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-14 19:51:11 +0800 |
commit | 3b54adc6c6d25dd146fa1eac21321f6bd612f50a (patch) | |
tree | 187895fa1ba7aa4e61ff17da16251d8b1bfa89fe /src | |
parent | 325d349f9da4518447ed34b327c261bfa56fc268 (diff) | |
parent | 5191a11d66b925561b5f705aa42759a0e2a5624a (diff) | |
download | rneovim-3b54adc6c6d25dd146fa1eac21321f6bd612f50a.tar.gz rneovim-3b54adc6c6d25dd146fa1eac21321f6bd612f50a.tar.bz2 rneovim-3b54adc6c6d25dd146fa1eac21321f6bd612f50a.zip |
Merge pull request #30378 from zeertzjq/vim-9.1.0729
vim-patch:9.1.{0729,0730}
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/drawline.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index b5273a54ca..3b88dd2e90 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -170,28 +170,26 @@ 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; - if (wp->w_virtcol >= (colnr_T)width1) { + if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0) { *right_col = width1 + ((wp->w_virtcol - width1) / width2 + 1) * width2; } if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0) { @@ -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. |