patch 8.2.3969: value of MAXCOL not available in Vim script
Problem: Value of MAXCOL not available in Vim script.
Solution: Add v:maxcol. (Naohiro Ono, closes #9451)
diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim
index b943059..965c704 100644
--- a/src/testdir/test_cursor_func.vim
+++ b/src/testdir/test_cursor_func.vim
@@ -38,6 +38,18 @@
quit!
endfunc
+func Test_curswant_maxcol()
+ new
+ call setline(1, 'foo')
+
+ " Test that after "$" command curswant is set to the same value as v:maxcol.
+ normal! 1G$
+ call assert_equal(v:maxcol, getcurpos()[4])
+ call assert_equal(v:maxcol, winsaveview().curswant)
+
+ quit!
+endfunc
+
" Very short version of what matchparen does.
function s:Highlight_Matching_Pair()
let save_cursor = getcurpos()
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 9794961..1005694 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -858,7 +858,7 @@
set nostartofline
exe "norm! $\<c-b>"
call assert_equal('92', getline('.'))
- call assert_equal([0, 92, 2, 0, 2147483647], getcurpos())
+ call assert_equal([0, 92, 2, 0, v:maxcol], getcurpos())
" cleanup
set startofline
bw!
@@ -902,7 +902,7 @@
norm! >>$ztzb
call assert_equal(' 30', getline('.'))
call assert_equal(30, winsaveview()['topline']+winheight(0)-1)
- call assert_equal([0, 30, 3, 0, 2147483647], getcurpos())
+ call assert_equal([0, 30, 3, 0, v:maxcol], getcurpos())
" Test for z-
1
@@ -2798,7 +2798,7 @@
call assert_equal([0, 14, 1, 0, 1], getcurpos())
" count > buffer content
norm! 120go
- call assert_equal([0, 14, 1, 0, 2147483647], getcurpos())
+ call assert_equal([0, 14, 1, 0, v:maxcol], getcurpos())
" clean up
bw!
endfunc
@@ -2980,7 +2980,7 @@
set nostartofline
exe "norm! $\<c-u>"
call assert_equal('95', getline('.'))
- call assert_equal([0, 95, 2, 0, 2147483647], getcurpos())
+ call assert_equal([0, 95, 2, 0, v:maxcol], getcurpos())
" cleanup
set startofline
bw!
diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim
index c390bbb..0fde026 100644
--- a/src/testdir/test_put.vim
+++ b/src/testdir/test_put.vim
@@ -205,7 +205,7 @@
call assert_equal([0, 1, 7, 0], getpos("']"))
normal Vyp
- call assert_equal([0, 1, 2147483647, 0], getpos("'>"))
+ call assert_equal([0, 1, v:maxcol, 0], getpos("'>"))
call assert_equal([0, 2, 7, 0], getpos("']"))
bwipe!
endfunc