diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-04-27 17:51:47 +0200 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2023-05-02 13:11:47 +0200 |
commit | a2f3855291a59254346545f9699084fe4fece31f (patch) | |
tree | 3215823577c97a86caa081ac19e438a3955f8634 /src | |
parent | 5e4df766f6e428659221f8eae144e9ed18574f8d (diff) | |
download | rneovim-a2f3855291a59254346545f9699084fe4fece31f.tar.gz rneovim-a2f3855291a59254346545f9699084fe4fece31f.tar.bz2 rneovim-a2f3855291a59254346545f9699084fe4fece31f.zip |
vim-patch:9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Problem: 'smoothscroll' cursor calculations wrong when 'number' is set.
Solution: Correct the code that computes the width. (closes vim/vim#11492)
https://github.com/vim/vim/commit/01ee52bab6041450095c53f9469b1b266a7e3d4d
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/move.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index cc8497f544..8113331c62 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -815,13 +815,14 @@ void curs_columns(win_T *wp, int may_scroll) if (wp->w_cursor.lnum == wp->w_topline && wp->w_skipcol > 0 && wp->w_wcol >= wp->w_skipcol) { - // w_skipcol excludes win_col_off(). Include it here, since w_wcol - // counts actual screen columns. + // Deduct by multiples of width2. This allows the long line wrapping + // formula below to correctly calculate the w_wcol value when wrapping. if (wp->w_skipcol <= width1) { - wp->w_wcol -= wp->w_width; + wp->w_wcol -= width2; } else { - wp->w_wcol -= wp->w_width * (((wp->w_skipcol - width1) / width2) + 1); + wp->w_wcol -= width2 * (((wp->w_skipcol - width1) / width2) + 1); } + did_sub_skipcol = true; } |