Mercurial > vim
diff src/move.c @ 31117:a5bf86083558 v9.0.0893
patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Commit: https://github.com/vim/vim/commit/01ee52bab6041450095c53f9469b1b266a7e3d4d
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Thu Nov 17 12:41:42 2022 +0000
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 https://github.com/vim/vim/issues/11492)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 17 Nov 2022 13:45:04 +0100 |
parents | b7834109fefe |
children | 8de082110e2d |
line wrap: on
line diff
--- a/src/move.c +++ b/src/move.c @@ -1127,13 +1127,15 @@ curs_columns( && curwin->w_skipcol > 0 && curwin->w_wcol >= curwin->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 (curwin->w_skipcol <= width1) - curwin->w_wcol -= curwin->w_width; + curwin->w_wcol -= width2; else - curwin->w_wcol -= curwin->w_width + curwin->w_wcol -= width2 * (((curwin->w_skipcol - width1) / width2) + 1); + did_sub_skipcol = TRUE; }