vim-patch:7.4.565

Problem:    Ranges for arguments, buffers, tabs, etc. are not checked to
            be valid but limited to the maximum.  This can cause the
wrong
            thing to happen.
Solution:   Give an error for an invalid value. (Marcin Szamotulski)
            Use windows range for ":wincmd".

https://code.google.com/p/vim/source/detail?r=v7-4-565
This commit is contained in:
Felipe Morales
2015-01-20 00:28:37 -03:00
parent d2ad709a1e
commit ca883df007
9 changed files with 122 additions and 53 deletions

View File

@@ -13,7 +13,7 @@ STARTTEST
:" Open three tab pages and use ":tabdo"
:0tabnew
:1tabnew
:888tabnew
:$tabnew
:tabdo call append(line('$'), 'this is tab page ' . tabpagenr())
:tabclose! 2
:tabrewind

View File

@@ -26,10 +26,9 @@ STARTTEST
:1arga c
:1arga b
:$argu
:+arga d
:$arga x
:call add(arglists, argv())
:$-10arga Y
:0arga Y
:call add(arglists, argv())
:%argd
:call add(arglists, argv())

View File

@@ -7,7 +7,7 @@ c
a b d
a d
a
a b c d x
Y a b c d x
a b c x
Y a b c x
a f

View File

@@ -28,7 +28,7 @@ STARTTEST
:new
:new
:2wincmd w
:-2close!
:-1close!
:let buffers = []
:windo call add(buffers, bufnr('%'))
:call add(tests, buffers)
@@ -62,7 +62,7 @@ STARTTEST
:let buffers = []
:windo call add(buffers, bufnr('%'))
:call add(tests, buffers)
:9hide
:$hide
:let buffers = []
:windo call add(buffers, bufnr('%'))
:call add(tests, buffers)

View File

@@ -1,8 +1,8 @@
Test for user command counts vim: set ft=vim :
STARTTEST
:let g:lines = []
:so tiny.vim
:let g:lines = []
:com -range=% RangeLines :call add(g:lines, 'RangeLines '.<line1>.' '.<line2>)
:com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '.<line1>.' '.<line2>)
:com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '.<line1>.' '.<line2>)
@@ -48,6 +48,46 @@ STARTTEST
:'<,'>RangeLines
:com -range=% -buffer LocalRangeLines :call add(g:lines, 'LocalRangeLines '.<line1>.' '.<line2>)
:'<,'>LocalRangeLines
:b1
ENDTEST
STARTTEST
:call add(g:lines, '')
:%argd
:arga a b c d
:let v:errmsg = ''
:5argu
:call add(g:lines, '5argu ' . v:errmsg)
:$argu
:call add(g:lines, '4argu ' . expand('%:t'))
:let v:errmsg = ''
:1argu
:call add(g:lines, '1argu ' . expand('%:t'))
:let v:errmsg = ''
:100b
:call add(g:lines, '100b ' . v:errmsg)
:split|split|split|split
:let v:errmsg = ''
:0close
:call add(g:lines, '0close ' . v:errmsg)
:$wincmd w
:$close
:call add(g:lines, '$close ' . winnr())
:let v:errmsg = ''
:$+close
:call add(g:lines, '$+close ' . v:errmsg)
:$tabe
:call add(g:lines, '$tabe ' . tabpagenr())
:let v:errmsg = ''
:$+tabe
:call add(g:lines, '$+tabe ' . v:errmsg)
:only!
:e x
:0tabm
:normal 1gt
:call add(g:lines, '0tabm ' . expand('%:t'))
:tabonly!
:only!
:e! test.out
:call append(0, g:lines)
:w|qa!

View File

@@ -17,3 +17,14 @@ RangeTabsAll 1 5
RangeLines 2 5
LocalRangeLines 2 5
5argu E16: Invalid range
4argu d
1argu a
100b E16: Invalid range
0close E16: Invalid range
$close 4
$+close E16: Invalid range
$tabe 2
$+tabe E16: Invalid range
0tabm x