From 4d074e39ea1228e4f04c70ecfe4e1196a9638176 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 17:06:55 +0900 Subject: vim-patch:7.4.754 Problem: Using CTRL-A in Visual mode does not work well. (Gary Johnson) Solution: Make it increment all numbers in the Visual area. (Christian Brabandt) https://github.com/vim/vim/commit/3a304b23823b089e499063e8211c5695d049f3ba --- src/nvim/testdir/Makefile | 3 +- src/nvim/testdir/test_increment.in | 143 +++++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_increment.ok | 66 +++++++++++++++++ 3 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 src/nvim/testdir/test_increment.in create mode 100644 src/nvim/testdir/test_increment.ok (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 41ce2daa91..c2fdca8514 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -28,6 +28,7 @@ SCRIPTS := \ test_charsearch.out \ test_close_count.out \ test_command_count.out \ + test_increment.out \ NEW_TESTS = @@ -131,7 +132,7 @@ test1.out: .gdbinit test1.in # Check if the test.out file matches test.ok. @/bin/sh -c "if test -f test.out; then \ - if diff test.out $*.ok; then \ + if diff -u test.out $*.ok; then \ mv -f test.out $*.out; \ else \ echo $* FAILED >> test.log; \ diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in new file mode 100644 index 0000000000..5b0ad06cf8 --- /dev/null +++ b/src/nvim/testdir/test_increment.in @@ -0,0 +1,143 @@ +Tests for using Ctrl-A/Ctrl-X on visual selections + +Test cases +========== + +1) Ctrl-A on visually selected number +Text: +foobar-10 + 1) Ctrl-A on start of line: + foobar-9 + 2) Ctrl-A on visually selected "-10": + foobar-9 + 3) Ctrl-A on visually selected "10": + foobar-11 + 4) Ctrl-X on visually selected "-10" + foobar-11 + 5) Ctrl-X on visually selected "10" + foobar-9 + +2) Ctrl-A on visually selected lines +Text: +10 +20 +30 +40 + + 1) Ctrl-A on visually selected lines: +11 +21 +31 +41 + + 2) Ctrl-X on visually selected lines: +9 +19 +29 +39 + +3) g Ctrl-A on visually selected lines, with non-numbers in between +Text: +10 + +20 + +30 + +40 + + 1) 2 g Ctrl-A on visually selected lines: +12 + +24 + +36 + +48 + 2) 2 g Ctrl-X on visually selected lines +8 + +16 + +24 + +32 + +4) Ctrl-A on non-number +Text: +foobar-10 + 1) visually select foobar: + foobar-10 + +STARTTEST +:so small.vim + +:" Test 1 +:/^S1=/+,/^E1=/-y a +:/^E1/+put a +:/^E1/+2put a +f-v$:/^E1/+3put a +f1v$:/^E1/+4put a +f-v$:/^E1/+5put a +f1v$ + +:" Test 22 +:/^S2=/+,/^E2=/-y a +:/^E2/+put a +V3k$:.+put a +V3k$ + +:" Test 3 +:/^S3=/+,/^E3=/-y a +:/^E3=/+put a +V6k2g:.+put a +V6k2g + +:" Test 4 +:/^S4=/+,/^E4=/-y a +:/^E4=/+put a +vf- + +:" Save the report +:/^# Test 1/,$w! test.out +:qa! + + +# Test 1 +S1====== +foobar-10 +E1====== + + + +# Test 2 +S2===== +10 +20 +30 +40 +E2===== + + + +# Test 3 +S3===== +10 + +20 + +30 + +40 +E3===== + + + +# Test 4 +S4===== +foobar-10 +E4===== + + +ENDTEST + diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok new file mode 100644 index 0000000000..4a61ad1d1d --- /dev/null +++ b/src/nvim/testdir/test_increment.ok @@ -0,0 +1,66 @@ +# Test 1 +S1====== +foobar-10 +E1====== + +foobar-9 +foobar-9 +foobar-11 +foobar-11 +foobar-9 + + +# Test 2 +S2===== +10 +20 +30 +40 +E2===== + +11 +21 +31 +41 + +9 +19 +29 +39 + +# Test 3 +S3===== +10 + +20 + +30 + +40 +E3===== + +12 + +24 + +36 + +48 + +8 + +16 + +24 + +32 + +# Test 4 +S4===== +foobar-10 +E4===== + +foobar-10 + +ENDTEST + -- cgit