patch 8.1.0212: preferred cursor column not set in interfaces
Problem: Preferred cursor column not set in interfaces.
Solution: Set w_set_curswant when setting the cursor. (David Hotham,
closes #3060)
diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim
index 2280792..e021a2f 100644
--- a/src/testdir/test_lua.vim
+++ b/src/testdir/test_lua.vim
@@ -555,3 +555,20 @@
call delete('Xlua_file')
bwipe!
endfunc
+
+func Test_set_cursor()
+ " Check that setting the cursor position works.
+ new
+ call setline(1, ['first line', 'second line'])
+ normal gg
+ lua << EOF
+w = vim.window()
+w.line = 1
+w.col = 5
+EOF
+ call assert_equal([1, 5], [line('.'), col('.')])
+
+ " Check that movement after setting cursor position keeps current column.
+ normal j
+ call assert_equal([2, 5], [line('.'), col('.')])
+endfunc
diff --git a/src/testdir/test_perl.vim b/src/testdir/test_perl.vim
index 0528814..661c65c 100644
--- a/src/testdir/test_perl.vim
+++ b/src/testdir/test_perl.vim
@@ -258,3 +258,16 @@
--perl
%bw!
endfunc
+
+func Test_set_cursor()
+ " Check that setting the cursor position works.
+ new
+ call setline(1, ['first line', 'second line'])
+ normal gg
+ perldo $curwin->Cursor(1, 5)
+ call assert_equal([1, 6], [line('.'), col('.')])
+
+ " Check that movement after setting cursor position keeps current column.
+ normal j
+ call assert_equal([2, 6], [line('.'), col('.')])
+endfunc
diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim
index fb98c1e..c438ba0 100644
--- a/src/testdir/test_python2.vim
+++ b/src/testdir/test_python2.vim
@@ -22,3 +22,17 @@
bwipe!
bwipe!
endfunc
+
+func Test_set_cursor()
+ " Check that setting the cursor position works.
+ py import vim
+ new
+ call setline(1, ['first line', 'second line'])
+ normal gg
+ pydo vim.current.window.cursor = (1, 5)
+ call assert_equal([1, 6], [line('.'), col('.')])
+
+ " Check that movement after setting cursor position keeps current column.
+ normal j
+ call assert_equal([2, 6], [line('.'), col('.')])
+endfunc
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim
index bb241da..69ad802 100644
--- a/src/testdir/test_python3.vim
+++ b/src/testdir/test_python3.vim
@@ -1,4 +1,4 @@
-" Test for python 2 commands.
+" Test for python 3 commands.
" TODO: move tests from test88.in here.
if !has('python3')
@@ -22,3 +22,17 @@
bwipe!
bwipe!
endfunc
+
+func Test_set_cursor()
+ " Check that setting the cursor position works.
+ py3 import vim
+ new
+ call setline(1, ['first line', 'second line'])
+ normal gg
+ py3do vim.current.window.cursor = (1, 5)
+ call assert_equal([1, 6], [line('.'), col('.')])
+
+ " Check that movement after setting cursor position keeps current column.
+ normal j
+ call assert_equal([2, 6], [line('.'), col('.')])
+endfunc
diff --git a/src/testdir/test_ruby.vim b/src/testdir/test_ruby.vim
index 0017f73..ae27b39 100644
--- a/src/testdir/test_ruby.vim
+++ b/src/testdir/test_ruby.vim
@@ -57,3 +57,16 @@
call assert_fails('rubyfile ' . tempfile)
call delete(tempfile)
endfunc
+
+func Test_set_cursor()
+ " Check that setting the cursor position works.
+ new
+ call setline(1, ['first line', 'second line'])
+ normal gg
+ rubydo $curwin.cursor = [1, 5]
+ call assert_equal([1, 6], [line('.'), col('.')])
+
+ " Check that movement after setting cursor position keeps current column.
+ normal j
+ call assert_equal([2, 6], [line('.'), col('.')])
+endfunc
diff --git a/src/testdir/test_tcl.vim b/src/testdir/test_tcl.vim
index 54e3617..c0eadc6 100644
--- a/src/testdir/test_tcl.vim
+++ b/src/testdir/test_tcl.vim
@@ -665,3 +665,16 @@
tcl unset bar
endfunc
+
+func Test_set_cursor()
+ " Check that setting the cursor position works.
+ new
+ call setline(1, ['first line', 'second line'])
+ normal gg
+ tcldo $::vim::current(window) cursor 1 5
+ call assert_equal([1, 5], [line('.'), col('.')])
+
+ " Check that movement after setting cursor position keeps current column.
+ normal j
+ call assert_equal([2, 5], [line('.'), col('.')])
+endfunc