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)
diff --git a/src/testdir/test_increment.vim b/src/testdir/test_increment.vim
index 31d3ef9..4a51b9c 100644
--- a/src/testdir/test_increment.vim
+++ b/src/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
@@ -796,4 +796,48 @@
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