patch 9.0.0863: col() and charcol() only work for the current window
Problem: col() and charcol() only work for the current window.
Solution: Add an optional winid argument. (Yegappan Lakshmanan,
closes #11466, closes #11461)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 131db10..d0508ce 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1484,7 +1484,8 @@
call assert_equal(0, col([1, 100]))
call assert_equal(0, col([1]))
call assert_equal(0, col(test_null_list()))
- call assert_fails('let c = col({})', 'E731:')
+ call assert_fails('let c = col({})', 'E1222:')
+ call assert_fails('let c = col(".", [])', 'E1210:')
" test for getting the visual start column
func T()
@@ -1514,6 +1515,15 @@
call assert_equal(4, col('.'))
set virtualedit&
+ " Test for getting the column number in another window
+ let winid = win_getid()
+ new
+ call win_execute(winid, 'normal 1G$')
+ call assert_equal(3, col('.', winid))
+ call win_execute(winid, 'normal 2G')
+ call assert_equal(8, col('$', winid))
+ call assert_equal(0, col('.', 5001))
+
bw!
endfunc