Mirror of the Vim source from https://github.com/vim/vim
Revisión | 5baf5e50049b3abcbbf63250bacee40dc2e387e1 (tree) |
---|---|
Tiempo | 2022-05-28 19:00:03 |
Autor | Bram Moolenaar <Bram@vim....> |
Commiter | Bram Moolenaar |
patch 8.2.5035: when splitting a window the changelist position moves
Commit: https://github.com/vim/vim/commit/e6f13b473cf2c270e4eab214e09be9825320c11b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat May 28 10:49:44 2022 +0100
@@ -1,5 +1,40 @@ | ||
1 | 1 | " Tests for the changelist functionality |
2 | 2 | |
3 | +" When splitting a window the changelist position is wrong. | |
4 | +" Test the changelist position after splitting a window. | |
5 | +" Test for the bug fixed by 7.4.386 | |
6 | +func Test_changelist() | |
7 | + let save_ul = &ul | |
8 | + enew! | |
9 | + call append('$', ['1', '2']) | |
10 | + exe "normal i\<C-G>u" | |
11 | + exe "normal Gkylpa\<C-G>u" | |
12 | + set ul=100 | |
13 | + exe "normal Gylpa\<C-G>u" | |
14 | + set ul=100 | |
15 | + normal gg | |
16 | + vsplit | |
17 | + normal g; | |
18 | + call assert_equal([3, 2], [line('.'), col('.')]) | |
19 | + normal g; | |
20 | + call assert_equal([2, 2], [line('.'), col('.')]) | |
21 | + call assert_fails('normal g;', 'E662:') | |
22 | + new | |
23 | + call assert_fails('normal g;', 'E664:') | |
24 | + %bwipe! | |
25 | + let &ul = save_ul | |
26 | +endfunc | |
27 | + | |
28 | +" Moving a split should not change its changelist index. | |
29 | +func Test_changelist_index_move_split() | |
30 | + exe "norm! iabc\<C-G>u\ndef\<C-G>u\nghi" | |
31 | + vsplit | |
32 | + normal 99g; | |
33 | + call assert_equal(0, getchangelist('%')[1]) | |
34 | + wincmd L | |
35 | + call assert_equal(0, getchangelist('%')[1]) | |
36 | +endfunc | |
37 | + | |
3 | 38 | " Tests for the getchangelist() function |
4 | 39 | func Test_changelist_index() |
5 | 40 | edit Xfile1.txt |
@@ -3228,31 +3228,6 @@ | ||
3228 | 3228 | enew! |
3229 | 3229 | endfunc |
3230 | 3230 | |
3231 | -" When splitting a window the changelist position is wrong. | |
3232 | -" Test the changelist position after splitting a window. | |
3233 | -" Test for the bug fixed by 7.4.386 | |
3234 | -func Test_changelist() | |
3235 | - let save_ul = &ul | |
3236 | - enew! | |
3237 | - call append('$', ['1', '2']) | |
3238 | - exe "normal i\<C-G>u" | |
3239 | - exe "normal Gkylpa\<C-G>u" | |
3240 | - set ul=100 | |
3241 | - exe "normal Gylpa\<C-G>u" | |
3242 | - set ul=100 | |
3243 | - normal gg | |
3244 | - vsplit | |
3245 | - normal g; | |
3246 | - call assert_equal([3, 2], [line('.'), col('.')]) | |
3247 | - normal g; | |
3248 | - call assert_equal([2, 2], [line('.'), col('.')]) | |
3249 | - call assert_fails('normal g;', 'E662:') | |
3250 | - new | |
3251 | - call assert_fails('normal g;', 'E664:') | |
3252 | - %bwipe! | |
3253 | - let &ul = save_ul | |
3254 | -endfunc | |
3255 | - | |
3256 | 3231 | func Test_nv_hat_count() |
3257 | 3232 | %bwipeout! |
3258 | 3233 | let l:nr = bufnr('%') + 1 |
@@ -735,6 +735,8 @@ | ||
735 | 735 | static int included_patches[] = |
736 | 736 | { /* Add new patch number below this line */ |
737 | 737 | /**/ |
738 | + 5035, | |
739 | +/**/ | |
738 | 740 | 5034, |
739 | 741 | /**/ |
740 | 742 | 5033, |
@@ -1354,9 +1354,6 @@ | ||
1354 | 1354 | p_wh = size; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | - // Keep same changelist position in new window. | |
1358 | - wp->w_changelistidx = oldwin->w_changelistidx; | |
1359 | - | |
1360 | 1357 | /* |
1361 | 1358 | * make the new window the current window |
1362 | 1359 | */ |
@@ -1431,6 +1428,10 @@ | ||
1431 | 1428 | } |
1432 | 1429 | newp->w_tagstackidx = oldp->w_tagstackidx; |
1433 | 1430 | newp->w_tagstacklen = oldp->w_tagstacklen; |
1431 | + | |
1432 | + // Keep same changelist position in new window. | |
1433 | + newp->w_changelistidx = oldp->w_changelistidx; | |
1434 | + | |
1434 | 1435 | #ifdef FEAT_FOLDING |
1435 | 1436 | copyFoldingState(oldp, newp); |
1436 | 1437 | #endif |