1
0
forked from aniani/vim

patch 8.2.3694: cannot use quotes in the count of an Ex command

Problem:    Cannot use quotes in the count of an Ex command.
Solution:   Add getdigits_quoted().  Give an error when misplacing a quote in
            a range. (closes #9240)
This commit is contained in:
Bram Moolenaar
2021-11-29 12:12:43 +00:00
parent 293eb9ba46
commit af377e34b0
5 changed files with 78 additions and 3 deletions

View File

@@ -677,4 +677,32 @@ func Test_delcommand_buffer()
call assert_equal(0, exists(':Global'))
endfunc
def Test_count_with_quotes()
command -count GetCount g:nr = <count>
execute("GetCount 1'2")
assert_equal(12, g:nr)
execute("GetCount 1'234'567")
assert_equal(1'234'567, g:nr)
execute("GetCount 1'234'567'890'123'456'789'012")
assert_equal(v:sizeoflong == 8 ? 9223372036854775807 : 2147483647, g:nr)
# TODO: test with negative number once this is supported
assert_fails("GetCount '12", "E488:")
assert_fails("GetCount 12'", "E488:")
assert_fails("GetCount 1''2", "E488:")
assert_fails(":1'2GetCount", 'E492:')
new
setline(1, 'text')
normal ma
execute(":1, 'aprint")
bwipe!
unlet g:nr
delcommand GetCount
enddef
" vim: shiftwidth=2 sts=2 expandtab