0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

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)
This commit is contained in:
Yegappan Lakshmanan
2022-11-12 16:07:47 +00:00
committed by Bram Moolenaar
parent 0aad88f073
commit 4c8d2f02b3
7 changed files with 75 additions and 15 deletions

View File

@@ -1484,7 +1484,8 @@ func Test_col()
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 @@ func Test_col()
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