summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/evalvars.c2
-rw-r--r--src/testdir/test_cursor_func.vim12
-rw-r--r--src/testdir/test_normal.vim8
-rw-r--r--src/testdir/test_put.vim2
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h3
6 files changed, 23 insertions, 6 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index 324355b19..ea98861b5 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -154,6 +154,7 @@ static struct vimvar
{VV_NAME("sizeofint", VAR_NUMBER), NULL, VV_RO},
{VV_NAME("sizeoflong", VAR_NUMBER), NULL, VV_RO},
{VV_NAME("sizeofpointer", VAR_NUMBER), NULL, VV_RO},
+ {VV_NAME("maxcol", VAR_NUMBER), NULL, VV_RO},
};
// shorthand
@@ -241,6 +242,7 @@ evalvars_init(void)
set_vim_var_nr(VV_SIZEOFINT, sizeof(int));
set_vim_var_nr(VV_SIZEOFLONG, sizeof(long));
set_vim_var_nr(VV_SIZEOFPOINTER, sizeof(char *));
+ set_vim_var_nr(VV_MAXCOL, MAXCOL);
set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER);
set_vim_var_nr(VV_TYPE_STRING, VAR_TYPE_STRING);
diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim
index b94305916..965c70496 100644
--- a/src/testdir/test_cursor_func.vim
+++ b/src/testdir/test_cursor_func.vim
@@ -38,6 +38,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/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 979496133..1005694e4 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -858,7 +858,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!
@@ -902,7 +902,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
@@ -2798,7 +2798,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
@@ -2980,7 +2980,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/src/testdir/test_put.vim b/src/testdir/test_put.vim
index c390bbb61..0fde02640 100644
--- a/src/testdir/test_put.vim
+++ b/src/testdir/test_put.vim
@@ -205,7 +205,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
diff --git a/src/version.c b/src/version.c
index 5f9e63904..c480380b7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3969,
+/**/
3968,
/**/
3967,
diff --git a/src/vim.h b/src/vim.h
index 21832ab47..87fdbb173 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2067,7 +2067,8 @@ typedef int sock_T;
#define VV_SIZEOFINT 100
#define VV_SIZEOFLONG 101
#define VV_SIZEOFPOINTER 102
-#define VV_LEN 103 // number of v: vars
+#define VV_MAXCOL 103
+#define VV_LEN 104 // number of v: vars
// used for v_number in VAR_BOOL and VAR_SPECIAL
#define VVAL_FALSE 0L // VAR_BOOL