Mercurial > vim
annotate src/testdir/test_virtualedit.vim @ 13074:66c014c71dad v8.0.1412
patch 8.0.1412: using free memory using setloclist()
commit https://github.com/vim/vim/commit/12237448499aaeb8c4f2be7a1deda60c0f160627
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 19 12:38:52 2017 +0100
patch 8.0.1412: using free memory using setloclist()
Problem: Using free memory using setloclist(). (Dominique Pelle)
Solution: Mark location list context as still in use when needed. (Yegappan
Lakshmanan, closes #2462)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Dec 2017 12:45:06 +0100 |
parents | 57e0b701611e |
children | 0fa21ba32e21 |
rev | line source |
---|---|
12164
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for 'virtualedit'. |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_yank_move_change() |
12279
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
4 new |
12164
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 call setline(1, [ |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 \ "func foo() error {", |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 \ "\tif n, err := bar();", |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 \ "\terr != nil {", |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 \ "\t\treturn err", |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 \ "\t}", |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 \ "\tn = n * n", |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 \ ]) |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 set virtualedit=all |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 set ts=4 |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 function! MoveSelectionDown(count) abort |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 normal! m` |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 silent! exe "'<,'>move'>+".a:count |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 norm! `` |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfunction |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 xmap ]e :<C-U>call MoveSelectionDown(v:count1)<CR> |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 2 |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 normal 2gg |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 normal J |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 normal jVj |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 normal ]e |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 normal ce |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 bwipe! |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 set virtualedit= |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 set ts=8 |
5d82470552ce
patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 endfunc |
12279
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
32 |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
33 func Test_paste_end_of_line() |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
34 new |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
35 set virtualedit=all |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
36 call setline(1, ['456', '123']) |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
37 normal! gg0"ay$ |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
38 exe "normal! 2G$lllA\<C-O>:normal! \"agP\r" |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
39 call assert_equal('123456', getline(2)) |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
40 |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
41 bwipe! |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
42 set virtualedit= |
57e0b701611e
patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents:
12164
diff
changeset
|
43 endfunc |