changeset 15492:126cdab63a83 v8.1.0754

patch 8.1.0754: preferred column is lost when setting 'cursorcolumn' commit https://github.com/vim/vim/commit/177ab9e0262b1b3a6120bea655864ead487210e5 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 15 21:12:57 2019 +0100 patch 8.1.0754: preferred column is lost when setting 'cursorcolumn' Problem: Preferred column is lost when setting 'cursorcolumn'. Solution: Change option flag to P_RWINONLY. (Takayuki Kurosawa, closes #3806)
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Jan 2019 21:15:05 +0100
parents 14431f051f9c
children 93691fbecb9a
files src/option.c src/testdir/test_cursor_func.vim src/version.c
diffstat 3 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -989,7 +989,7 @@ static struct vimoption options[] =
     {"cursorbind",  "crb",  P_BOOL|P_VI_DEF,
 			    (char_u *)VAR_WIN, PV_CRBIND,
 			    {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
-    {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWIN,
+    {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWINONLY,
 #ifdef FEAT_SYN_HL
 			    (char_u *)VAR_WIN, PV_CUC,
 #else
--- a/src/testdir/test_cursor_func.vim
+++ b/src/testdir/test_cursor_func.vim
@@ -46,3 +46,23 @@ func Test_curswant_with_autocommand()
   quit!
 endfunc
 
+" Tests for behavior of curswant with cursorcolumn/line
+func Test_curswant_with_cursorcolumn()
+  new
+  call setline(1, ['01234567', ''])
+  exe "normal! ggf6j"
+  call assert_equal(6, winsaveview().curswant)
+  set cursorcolumn
+  call assert_equal(6, winsaveview().curswant)
+  quit!
+endfunc
+
+func Test_curswant_with_cursorline()
+  new
+  call setline(1, ['01234567', ''])
+  exe "normal! ggf6j"
+  call assert_equal(6, winsaveview().curswant)
+  set cursorline
+  call assert_equal(6, winsaveview().curswant)
+  quit!
+endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -796,6 +796,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    754,
+/**/
     753,
 /**/
     752,