Patch 9.0.0707
Problem: With 'smoothscroll' and 'scrolloff' non-zero the cursor position
is not properly adjusted in a long line.
Solution: Move the cursor further up or down in the line.
Files: src/move.c, src/testdir/test_scroll_opt.vim,
src/testdir/dumps/Test_smooth_long_6.dump,
src/testdir/dumps/Test_smooth_long_7.dump,
src/testdir/dumps/Test_smooth_long_8.dump,
src/testdir/dumps/Test_smooth_long_9.dump
*** ../vim-9.0.0706/src/move.c 2022-10-08 21:13:16.632848892 +0100
--- src/move.c 2022-10-09 17:18:41.285545381 +0100
***************
*** 1605,1613 ****
if (curwin->w_cursor.lnum == curwin->w_topline && do_sms)
{
// make sure the cursor is in the visible text
validate_virtcol();
! int col = curwin->w_virtcol - curwin->w_skipcol;
int row = 0;
if (col >= width1)
{
--- 1605,1616 ----
if (curwin->w_cursor.lnum == curwin->w_topline && do_sms)
{
+ long so = curwin->w_p_so >= 0 ? curwin->w_p_so : p_so;
+ int scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
+
// make sure the cursor is in the visible text
validate_virtcol();
! int col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
int row = 0;
if (col >= width1)
{
***************
*** 1620,1627 ****
col = col % width2;
}
if (row >= curwin->w_height)
! coladvance(curwin->w_virtcol
! - (row - curwin->w_height + 1) * width2);
}
}
--- 1623,1633 ----
col = col % width2;
}
if (row >= curwin->w_height)
! {
! curwin->w_curswant = curwin->w_virtcol
! - (row - curwin->w_height + 1) * width2;
! coladvance(curwin->w_curswant);
! }
}
}
***************
*** 1748,1766 ****
if (curwin->w_cursor.lnum == curwin->w_topline
&& do_sms && curwin->w_skipcol > 0)
{
! // make sure the cursor is in a visible part of the line
validate_virtcol();
! if (curwin->w_virtcol < curwin->w_skipcol + 3)
{
- int width1 = curwin->w_width - curwin_col_off();
- int width2 = width1 + curwin_col_off2();
colnr_T col = curwin->w_virtcol;
if (col < width1)
col += width1;
! while (col < curwin->w_skipcol + 3)
col += width2;
! coladvance(col);
}
}
}
--- 1754,1777 ----
if (curwin->w_cursor.lnum == curwin->w_topline
&& do_sms && curwin->w_skipcol > 0)
{
! int width1 = curwin->w_width - curwin_col_off();
! int width2 = width1 + curwin_col_off2();
! long so = curwin->w_p_so >= 0 ? curwin->w_p_so : p_so;
! int scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
!
! // Make sure the cursor is in a visible part of the line, taking
! // 'scrolloff' into account, but using screen lines.
validate_virtcol();
! if (curwin->w_virtcol < curwin->w_skipcol + 3 + scrolloff_cols)
{
colnr_T col = curwin->w_virtcol;
if (col < width1)
col += width1;
! while (col < curwin->w_skipcol + 3 + scrolloff_cols)
col += width2;
! curwin->w_curswant = col;
! coladvance(curwin->w_curswant);
}
}
}
*** ../vim-9.0.0706/src/testdir/test_scroll_opt.vim 2022-10-08
21:13:16.632848892 +0100
--- src/testdir/test_scroll_opt.vim 2022-10-09 17:15:07.562475309 +0100
***************
*** 223,228 ****
--- 223,250 ----
call term_sendkeys(buf, "\<C-Y>")
call VerifyScreenDump(buf, 'Test_smooth_long_5', {})
+ " 'scrolloff' set to 1, scrolling up, cursor moves screen line down
+ call term_sendkeys(buf, ":set scrolloff=1\<CR>")
+ call term_sendkeys(buf, "10|\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_6', {})
+
+ " 'scrolloff' set to 1, scrolling down, cursor moves screen line up
+ call term_sendkeys(buf, "\<C-E>")
+ call term_sendkeys(buf, "gjgj")
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_7', {})
+
+ " 'scrolloff' set to 2, scrolling up, cursor moves screen line down
+ call term_sendkeys(buf, ":set scrolloff=2\<CR>")
+ call term_sendkeys(buf, "10|\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_8', {})
+
+ " 'scrolloff' set to 2, scrolling down, cursor moves screen line up
+ call term_sendkeys(buf, "\<C-E>")
+ call term_sendkeys(buf, "gj")
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_9', {})
+
call StopVimInTerminal(buf)
endfunc
*** ../vim-9.0.0706/src/testdir/dumps/Test_smooth_long_6.dump 2022-10-09
17:16:18.394153041 +0100
--- src/testdir/dumps/Test_smooth_long_6.dump 2022-10-09 17:12:07.931372850
+0100
***************
*** 0 ****
--- 1,6 ----
+ |<+0#4040ff13#ffffff0@2|t+0#0000000&|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h|
|l|o|t|s| |o|f| |t|e|x|t| |w|i|t
+ |h| |l|o|t|s| |o|f> |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h|
|l|o
+ |t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s|
|o
+ |f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f|
|t|e
+ |x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t|
|w
+ | @21|3|,|9|0| @9|B|o|t|
*** ../vim-9.0.0706/src/testdir/dumps/Test_smooth_long_7.dump 2022-10-09
17:16:18.398153024 +0100
--- src/testdir/dumps/Test_smooth_long_7.dump 2022-10-09 17:12:11.371354390
+0100
***************
*** 0 ****
--- 1,6 ----
+ |<+0#4040ff13#ffffff0@2|t+0#0000000&|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h|
|l|o|t|s| |o|f| |t|e|x|t| |w|i|t
+ |h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h|
|l|o
+ |t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s|
|o
+ |f| |t|e|x|t| |w|i>t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f|
|t|e
+ |x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t|
|w
+ | @21|3|,|1|7|0| @8|B|o|t|
*** ../vim-9.0.0706/src/testdir/dumps/Test_smooth_long_8.dump 2022-10-09
17:16:18.406152988 +0100
--- src/testdir/dumps/Test_smooth_long_8.dump 2022-10-09 17:15:12.534452177
+0100
***************
*** 0 ****
--- 1,6 ----
+ |<+0#4040ff13#ffffff0@2|t+0#0000000&|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h|
|l|o|t|s| |o|f| |t|e|x|t| |w|i|t
+ |h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h|
|l|o
+ |t|s| |o|f| |t|e|x>t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s|
|o
+ |f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f|
|t|e
+ |x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t|
|w
+ | @21|3|,|1|3|0| @8|B|o|t|
*** ../vim-9.0.0706/src/testdir/dumps/Test_smooth_long_9.dump 2022-10-09
17:16:18.410152971 +0100
--- src/testdir/dumps/Test_smooth_long_9.dump 2022-10-09 17:15:13.682446847
+0100
***************
*** 0 ****
--- 1,6 ----
+ |<+0#4040ff13#ffffff0@2|o+0#0000000&|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s|
|o|f| |t|e|x|t| |w|i|t|h| |l|o
+ |t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s|
|o
+ |f| |t|e|x|t| |w|i>t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f|
|t|e
+ |x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t|
|w
+ |i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t|
|w|i|t|h|
+ @22|3|,|1|7|0| @8|B|o|t|
*** ../vim-9.0.0706/src/version.c 2022-10-09 15:54:49.607956591 +0100
--- src/version.c 2022-10-09 17:16:25.090123365 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 707,
/**/
--
This is the polymorph virus! Follow these instructions carefully:
1. Send this message to everybody you know.
2. Format your harddisk.
Thank you for your cooperation in spreading the most powerful virus ever!
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221009162014.D59C61C03D0%40moolenaar.net.