• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisión5baf5e50049b3abcbbf63250bacee40dc2e387e1 (tree)
Tiempo2022-05-28 19:00:03
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

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

patch 8.2.5035: when splitting a window the changelist position moves
Problem: When splitting a window the changelist position moves.
Solution: Set the changelist index a bit later. (closes https://github.com/vim/vim/issues/10493)

Cambiar Resumen

Diferencia incremental

diff -r 81a69e9445c8 -r 5baf5e50049b src/testdir/test_changelist.vim
--- a/src/testdir/test_changelist.vim Fri May 27 23:00:04 2022 +0200
+++ b/src/testdir/test_changelist.vim Sat May 28 12:00:03 2022 +0200
@@ -1,5 +1,40 @@
11 " Tests for the changelist functionality
22
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+
338 " Tests for the getchangelist() function
439 func Test_changelist_index()
540 edit Xfile1.txt
diff -r 81a69e9445c8 -r 5baf5e50049b src/testdir/test_normal.vim
--- a/src/testdir/test_normal.vim Fri May 27 23:00:04 2022 +0200
+++ b/src/testdir/test_normal.vim Sat May 28 12:00:03 2022 +0200
@@ -3228,31 +3228,6 @@
32283228 enew!
32293229 endfunc
32303230
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-
32563231 func Test_nv_hat_count()
32573232 %bwipeout!
32583233 let l:nr = bufnr('%') + 1
diff -r 81a69e9445c8 -r 5baf5e50049b src/version.c
--- a/src/version.c Fri May 27 23:00:04 2022 +0200
+++ b/src/version.c Sat May 28 12:00:03 2022 +0200
@@ -735,6 +735,8 @@
735735 static int included_patches[] =
736736 { /* Add new patch number below this line */
737737 /**/
738+ 5035,
739+/**/
738740 5034,
739741 /**/
740742 5033,
diff -r 81a69e9445c8 -r 5baf5e50049b src/window.c
--- a/src/window.c Fri May 27 23:00:04 2022 +0200
+++ b/src/window.c Sat May 28 12:00:03 2022 +0200
@@ -1354,9 +1354,6 @@
13541354 p_wh = size;
13551355 }
13561356
1357- // Keep same changelist position in new window.
1358- wp->w_changelistidx = oldwin->w_changelistidx;
1359-
13601357 /*
13611358 * make the new window the current window
13621359 */
@@ -1431,6 +1428,10 @@
14311428 }
14321429 newp->w_tagstackidx = oldp->w_tagstackidx;
14331430 newp->w_tagstacklen = oldp->w_tagstacklen;
1431+
1432+ // Keep same changelist position in new window.
1433+ newp->w_changelistidx = oldp->w_changelistidx;
1434+
14341435 #ifdef FEAT_FOLDING
14351436 copyFoldingState(oldp, newp);
14361437 #endif
Show on old repository browser