Am 13.04.2011 20:45, schrieb Bram Moolenaar:
ZyX wrote:
:com! -range TestZeroRange echo<line1> <line2>
:0TestZeroRange
1 1
Zero is converted to one.
Shouldn't that be regarded a bug?
1. It is not a bug because first line has number `1', not `0'.
2. `:0read!echo "abc"' and `:1read!echo "abc"' are different, so you
may want to
punish Bram for having yet another hack for built-in commands.
You can use -range=1 to allow for a zero line number.
OK.
But a:firstline and a:lastline never become zero.
" -range=1 allows for zero range!
echo "A <line1> <line2> <count>"
com! -range=1 TestZeroRangeA echo <line1> <line2> <count>
0 TestZeroRangeA
" 0 0 0
TestZeroRangeA
" 12 1 1
3,5 TestZeroRangeA
" 3 5 5
echo "B a:firstline a:lastline"
com! -range=1 TestZeroRangeB <line1>,<line2>call TestZeroRangeB()
func! TestZeroRangeB() range
echo a:firstline a:lastline
endfunc
0 TestZeroRangeB
" 1 1
echo "C line1 line2"
com! -range=1 TestZeroRangeC call TestZeroRangeC(<line1>, <line2>)
func! TestZeroRangeC(line1, line2)
echo a:line1 a:line1
endfunc
0 TestZeroRangeC
" 0 0
--
Andy
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php