comparison src/testdir/test_blockedit.vim @ 25072:bd46322bea66 v8.2.3073

patch 8.2.3073: when cursor is move for block append wrong text is inserted Commit: https://github.com/vim/vim/commit/4067bd3604215b48e4b4201e28f9e401b08418e4 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 29 18:54:35 2021 +0200 patch 8.2.3073: when cursor is move for block append wrong text is inserted Problem: When cursor is move for block append wrong text is inserted. Solution: Calculate an offset. (Christian Brabandt, closes https://github.com/vim/vim/issues/8433, closes #8288)
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Jun 2021 19:00:05 +0200
parents 08940efa6b4e
children 294736db2561
comparison
equal deleted inserted replaced
25071:1b6cde423089 25072:bd46322bea66
26 " reset to sane state 26 " reset to sane state
27 let &bs = _bs 27 let &bs = _bs
28 bwipe! 28 bwipe!
29 endfunc 29 endfunc
30 30
31 func Test_blockappend_eol_cursor()
32 new
33 " Test 1 Move 1 char left
34 call setline(1, ['aaa', 'bbb', 'ccc'])
35 exe "norm! gg$\<c-v>2jA\<left>x\<esc>"
36 call assert_equal(['aaxa', 'bbxb', 'ccxc'], getline(1, '$'))
37 " Test 2 Move 2 chars left
38 sil %d
39 call setline(1, ['aaa', 'bbb', 'ccc'])
40 exe "norm! gg$\<c-v>2jA\<left>\<left>x\<esc>"
41 call assert_equal(['axaa', 'bxbb', 'cxcc'], getline(1, '$'))
42 " Test 3 Move 3 chars left (outside of the visual selection)
43 sil %d
44 call setline(1, ['aaa', 'bbb', 'ccc'])
45 exe "norm! ggl$\<c-v>2jA\<left>\<left>\<left>x\<esc>"
46 call assert_equal(['xaaa', 'bbb', 'ccc'], getline(1, '$'))
47 bw!
48 endfunc
49
50 func Test_blockappend_eol_cursor2()
51 new
52 " Test 1 Move 1 char left
53 call setline(1, ['aaaaa', 'bbb', 'ccccc'])
54 exe "norm! gg\<c-v>$2jA\<left>x\<esc>"
55 call assert_equal(['aaaaxa', 'bbbx', 'ccccxc'], getline(1, '$'))
56 " Test 2 Move 2 chars left
57 sil %d
58 call setline(1, ['aaaaa', 'bbb', 'ccccc'])
59 exe "norm! gg\<c-v>$2jA\<left>\<left>x\<esc>"
60 call assert_equal(['aaaxaa', 'bbbx', 'cccxcc'], getline(1, '$'))
61 " Test 3 Move 3 chars left (to the beginning of the visual selection)
62 sil %d
63 call setline(1, ['aaaaa', 'bbb', 'ccccc'])
64 exe "norm! gg\<c-v>$2jA\<left>\<left>\<left>x\<esc>"
65 call assert_equal(['aaxaaa', 'bbxb', 'ccxccc'], getline(1, '$'))
66 " Test 4 Move 3 chars left (outside of the visual selection)
67 sil %d
68 call setline(1, ['aaaaa', 'bbb', 'ccccc'])
69 exe "norm! ggl\<c-v>$2jA\<left>\<left>\<left>x\<esc>"
70 call assert_equal(['aaxaaa', 'bbxb', 'ccxccc'], getline(1, '$'))
71 " Test 5 Move 4 chars left (outside of the visual selection)
72 sil %d
73 call setline(1, ['aaaaa', 'bbb', 'ccccc'])
74 exe "norm! ggl\<c-v>$2jA\<left>\<left>\<left>\<left>x\<esc>"
75 call assert_equal(['axaaaa', 'bxbb', 'cxcccc'], getline(1, '$'))
76 bw!
77 endfunc
78
31 " vim: shiftwidth=2 sts=2 expandtab 79 " vim: shiftwidth=2 sts=2 expandtab