aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-03-07 11:04:36 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-03-07 11:33:23 +0800
commit2882b1543a4f30ee3d7b039a5d51bb994fd6aa1d (patch)
tree83983b49947c3bb581461419db2951909c88e932 /test
parent7a44231832fbeb0fe87553f75519ca46e91cb7ab (diff)
downloadrneovim-2882b1543a4f30ee3d7b039a5d51bb994fd6aa1d.tar.gz
rneovim-2882b1543a4f30ee3d7b039a5d51bb994fd6aa1d.tar.bz2
rneovim-2882b1543a4f30ee3d7b039a5d51bb994fd6aa1d.zip
vim-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 vim/vim#9451) https://github.com/vim/vim/commit/56200eed62e59ad831f6564dcafe346e6f97ac20 The variable is always 2147483647, but introducing it makes functions easier to document. Co-authored-by: naohiro ono <obcat@icloud.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_cursor_func.vim12
-rw-r--r--test/old/testdir/test_normal.vim8
-rw-r--r--test/old/testdir/test_put.vim2
3 files changed, 17 insertions, 5 deletions
diff --git a/test/old/testdir/test_cursor_func.vim b/test/old/testdir/test_cursor_func.vim
index bb8e7cd5c5..239eff5db5 100644
--- a/test/old/testdir/test_cursor_func.vim
+++ b/test/old/testdir/test_cursor_func.vim
@@ -40,6 +40,18 @@ func Test_move_cursor()
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/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index 48e6bc5298..ca91ab2ceb 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -921,7 +921,7 @@ func Test_normal14_page()
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!
@@ -966,7 +966,7 @@ func Test_normal15_z_scroll_vert()
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
@@ -2917,7 +2917,7 @@ func Test_normal36_g_cmd5()
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
@@ -3097,7 +3097,7 @@ func Test_normal42_halfpage()
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/test/old/testdir/test_put.vim b/test/old/testdir/test_put.vim
index 25fc5a2f04..6c7cfa09c6 100644
--- a/test/old/testdir/test_put.vim
+++ b/test/old/testdir/test_put.vim
@@ -209,7 +209,7 @@ func Test_multibyte_op_end_mark()
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