diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/if_lua.c | 1 | ||||
-rw-r--r-- | src/if_mzsch.c | 1 | ||||
-rw-r--r-- | src/if_perl.xs | 1 | ||||
-rw-r--r-- | src/if_py_both.h | 1 | ||||
-rw-r--r-- | src/if_ruby.c | 1 | ||||
-rw-r--r-- | src/if_tcl.c | 1 | ||||
-rw-r--r-- | src/testdir/test_lua.vim | 17 | ||||
-rw-r--r-- | src/testdir/test_perl.vim | 13 | ||||
-rw-r--r-- | src/testdir/test_python2.vim | 14 | ||||
-rw-r--r-- | src/testdir/test_python3.vim | 16 | ||||
-rw-r--r-- | src/testdir/test_ruby.vim | 13 | ||||
-rw-r--r-- | src/testdir/test_tcl.vim | 13 | ||||
-rw-r--r-- | src/version.c | 2 |
13 files changed, 93 insertions, 1 deletions
diff --git a/src/if_lua.c b/src/if_lua.c index c0d809adc9..7602c80de4 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -1377,6 +1377,7 @@ luaV_window_newindex (lua_State *L) luaV_checksandbox(L); #endif w->w_cursor.col = v - 1; + w->w_set_curswant = TRUE; update_screen(VALID); } else if (strncmp(s, "width", 5) == 0) diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 54474bd807..23b67a99b2 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -2132,6 +2132,7 @@ set_cursor(void *data, int argc, Scheme_Object **argv) win->win->w_cursor.lnum = lnum; win->win->w_cursor.col = col; + win->win->w_set_curswant = TRUE; update_screen(VALID); raise_if_error(); diff --git a/src/if_perl.xs b/src/if_perl.xs index 55a24c6ac7..bc15efa944 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -1691,6 +1691,7 @@ Cursor(win, ...) col = (int) SvIV(ST(2)); win->w_cursor.lnum = lnum; win->w_cursor.col = col; + win->w_set_curswant = TRUE; check_cursor(); /* put cursor on an existing line */ update_screen(NOT_VALID); } diff --git a/src/if_py_both.h b/src/if_py_both.h index 58db254dcc..459bc50cdd 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -3985,6 +3985,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject) self->win->w_cursor.lnum = lnum; self->win->w_cursor.col = col; + self->win->w_set_curswant = TRUE; #ifdef FEAT_VIRTUALEDIT self->win->w_cursor.coladd = 0; #endif diff --git a/src/if_ruby.c b/src/if_ruby.c index d67801dfa5..4b9af318d2 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -1517,6 +1517,7 @@ static VALUE window_set_cursor(VALUE self, VALUE pos) col = RARRAY_PTR(pos)[1]; win->w_cursor.lnum = NUM2LONG(lnum); win->w_cursor.col = NUM2UINT(col); + win->w_set_curswant = TRUE; check_cursor(); /* put cursor on an existing line */ update_screen(NOT_VALID); return Qnil; diff --git a/src/if_tcl.c b/src/if_tcl.c index 9ecabf84c5..228936554c 100644 --- a/src/if_tcl.c +++ b/src/if_tcl.c @@ -1091,6 +1091,7 @@ winselfcmd( /* TODO: should check column */ win->w_cursor.lnum = val1; win->w_cursor.col = col2vim(val2); + win->w_set_curswant = TRUE; flags |= FL_UPDATE_SCREEN; break; diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim index 2280792034..e021a2f447 100644 --- a/src/testdir/test_lua.vim +++ b/src/testdir/test_lua.vim @@ -555,3 +555,20 @@ func Test_luafile_error() 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 0528814b42..661c65cdc8 100644 --- a/src/testdir/test_perl.vim +++ b/src/testdir/test_perl.vim @@ -258,3 +258,16 @@ func Test_000_SvREFCNT() --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 fb98c1eda7..c438ba0415 100644 --- a/src/testdir/test_python2.vim +++ b/src/testdir/test_python2.vim @@ -22,3 +22,17 @@ func Test_pydo() 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 bb241dacb1..69ad802131 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 @@ func Test_py3do() 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 0017f73aef..ae27b39cd3 100644 --- a/src/testdir/test_ruby.vim +++ b/src/testdir/test_ruby.vim @@ -57,3 +57,16 @@ func Test_rubyfile() 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 54e3617a7a..c0eadc6372 100644 --- a/src/testdir/test_tcl.vim +++ b/src/testdir/test_tcl.vim @@ -665,3 +665,16 @@ func Test_tcl_exit() 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 diff --git a/src/version.c b/src/version.c index 24753d1e55..81ed54446b 100644 --- a/src/version.c +++ b/src/version.c @@ -794,6 +794,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 212, +/**/ 211, /**/ 210, |