From 04a4bbbe56fd6cbc164730cb9beab4ec6fefe3b0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 28 Apr 2021 09:06:05 -0400 Subject: vim-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 vim/vim#6144) https://github.com/vim/vim/commit/aaad995f8384a77a64efba6846c9c4ac99de0953 --- src/nvim/testdir/test_increment.vim | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.vim b/src/nvim/testdir/test_increment.vim index f81f8edbde..6d08cd40a8 100644 --- a/src/nvim/testdir/test_increment.vim +++ b/src/nvim/testdir/test_increment.vim @@ -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 @@ -779,6 +779,50 @@ func Test_increment_empty_line() bwipe! endfunc +" Try incrementing/decrementing a number when nrformats contains unsigned +func Test_increment_unsigned() + set nrformats+=unsigned + + call setline(1, '0') + exec "norm! gg0\" + call assert_equal('0', getline(1)) + + call setline(1, '3') + exec "norm! gg010\" + call assert_equal('0', getline(1)) + + call setline(1, '-0') + exec "norm! gg0\" + call assert_equal("-0", getline(1)) + + call setline(1, '-11') + exec "norm! gg08\" + call assert_equal('-3', getline(1)) + + " NOTE: 18446744073709551615 == 2^64 - 1 + call setline(1, '18446744073709551615') + exec "norm! gg0\" + call assert_equal('18446744073709551615', getline(1)) + + call setline(1, '-18446744073709551615') + exec "norm! gg0\" + call assert_equal('-18446744073709551615', getline(1)) + + call setline(1, '-18446744073709551614') + exec "norm! gg08\" + call assert_equal('-18446744073709551615', getline(1)) + + call setline(1, '-1') + exec "norm! gg0\" + call assert_equal('-2', getline(1)) + + call setline(1, '-3') + exec "norm! gg08\" + call assert_equal('-11', getline(1)) + + set nrformats-=unsigned +endfunc + func Test_normal_increment_with_virtualedit() set virtualedit=all -- cgit