0
0
mirror of https://github.com/vim/vim.git synced 2025-11-09 10:37:17 -05:00

patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers

Problem:    Cannot use CTRL-A and CTRL-X on unsigned numbers.
Solution:   Add "unsigned" to 'nrformats'. (Naruhiko Nishino, closes #6144)
This commit is contained in:
Bram Moolenaar
2020-05-31 15:08:59 +02:00
parent f09715bc5c
commit aaad995f83
5 changed files with 97 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
" Tests for using Ctrl-A/Ctrl-X on visual selections
" Tests for using Ctrl-A/Ctrl-X
func SetUp()
new dummy
@@ -796,4 +796,48 @@ func Test_increment_special_char()
call assert_beeps("normal \<C-X>")
endfunc
" Try incrementing/decrementing a number when nrformats contains unsigned
func Test_increment_unsigned()
set nrformats+=unsigned
call setline(1, '0')
exec "norm! gg0\<C-X>"
call assert_equal('0', getline(1))
call setline(1, '3')
exec "norm! gg010\<C-X>"
call assert_equal('0', getline(1))
call setline(1, '-0')
exec "norm! gg0\<C-X>"
call assert_equal("-0", getline(1))
call setline(1, '-11')
exec "norm! gg08\<C-X>"
call assert_equal('-3', getline(1))
" NOTE: 18446744073709551615 == 2^64 - 1
call setline(1, '18446744073709551615')
exec "norm! gg0\<C-A>"
call assert_equal('18446744073709551615', getline(1))
call setline(1, '-18446744073709551615')
exec "norm! gg0\<C-A>"
call assert_equal('-18446744073709551615', getline(1))
call setline(1, '-18446744073709551614')
exec "norm! gg08\<C-A>"
call assert_equal('-18446744073709551615', getline(1))
call setline(1, '-1')
exec "norm! gg0\<C-A>"
call assert_equal('-2', getline(1))
call setline(1, '-3')
exec "norm! gg08\<C-A>"
call assert_equal('-11', getline(1))
set nrformats-=unsigned
endfunc
" vim: shiftwidth=2 sts=2 expandtab