]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h" v9.0.1545
authorLuuk van Baal <luukvbaal@gmail.com>
Fri, 12 May 2023 14:47:25 +0000 (15:47 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 12 May 2023 14:47:25 +0000 (15:47 +0100)
Problem:    Text not scrolled when cursor moved with "g0" and "h".
Solution:   Adjust w_skipcol when needed. (Luuk van Baal, closes #12387)

src/edit.c
src/normal.c
src/testdir/test_scroll_opt.vim
src/version.c

index c23b0a8556b1bf5610e4a7e5ae6622e42a86b1e4..64edddce8dd8f876b462034e74c1a4e5580ec409 100644 (file)
@@ -2734,6 +2734,7 @@ oneleft(void)
        }
 
        curwin->w_set_curswant = TRUE;
+       adjust_skipcol();
        return OK;
     }
 
index 2f3d12a41b2a7b7efd8b4feb903f38e5e2d0a380..07201341a86174df948941b681289f1393ade710 100644 (file)
@@ -5762,6 +5762,7 @@ nv_g_home_m_cmd(cmdarg_T *cap)
        curwin->w_valid &= ~VALID_WCOL;
     }
     curwin->w_set_curswant = TRUE;
+    adjust_skipcol();
 }
 
 /*
index c12da9786bde5c3c5620a0cfd6710ed3cb4a380b..0bdf6840b944e451c0d1741857b32072529b15f2 100644 (file)
@@ -419,6 +419,18 @@ func Test_smoothscroll_cursor_position()
   exe "normal \<C-Y>"
   call s:check_col_calc(1, 3, 41)
 
+  " Test "g0/g<Home>"
+  exe "normal gg\<C-E>"
+  norm $gkg0
+  call s:check_col_calc(1, 2, 21)
+
+  " Test moving the cursor behind the <<< display with 'virtualedit'
+  set virtualedit=all
+  exe "normal \<C-E>"
+  norm 3lgkh
+  call s:check_col_calc(3, 2, 23)
+  set virtualedit&
+
   normal gg3l
   exe "normal \<C-E>"
 
index 4f2b2a72bea18061fead7a0368e2fe25433d3c7d..f13f8e093e60ccceb905f35d676f5b3f3be24838 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1545,
 /**/
     1544,
 /**/