comparison 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
comparison
equal deleted inserted replaced
31116:420dd432f723 31117:a5bf86083558
1125 // skip columns that are not visible 1125 // skip columns that are not visible
1126 if (curwin->w_cursor.lnum == curwin->w_topline 1126 if (curwin->w_cursor.lnum == curwin->w_topline
1127 && curwin->w_skipcol > 0 1127 && curwin->w_skipcol > 0
1128 && curwin->w_wcol >= curwin->w_skipcol) 1128 && curwin->w_wcol >= curwin->w_skipcol)
1129 { 1129 {
1130 // w_skipcol excludes win_col_off(). Include it here, since w_wcol 1130 // Deduct by multiples of width2. This allows the long line
1131 // counts actual screen columns. 1131 // wrapping formula below to correctly calculate the w_wcol value
1132 // when wrapping.
1132 if (curwin->w_skipcol <= width1) 1133 if (curwin->w_skipcol <= width1)
1133 curwin->w_wcol -= curwin->w_width; 1134 curwin->w_wcol -= width2;
1134 else 1135 else
1135 curwin->w_wcol -= curwin->w_width 1136 curwin->w_wcol -= width2
1136 * (((curwin->w_skipcol - width1) / width2) + 1); 1137 * (((curwin->w_skipcol - width1) / width2) + 1);
1138
1137 did_sub_skipcol = TRUE; 1139 did_sub_skipcol = TRUE;
1138 } 1140 }
1139 1141
1140 // long line wrapping, adjust curwin->w_wrow 1142 // long line wrapping, adjust curwin->w_wrow
1141 if (curwin->w_wcol >= curwin->w_width) 1143 if (curwin->w_wcol >= curwin->w_width)