To: vim_dev@googlegroups.com Subject: Patch 8.2.5035 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5035 Problem: When splitting a window the changelist position moves. Solution: Set the changelist index a bit later. (closes #10493) Files: src/window.c, src/testdir/test_changelist.vim, src/testdir/test_normal.vim *** ../vim-8.2.5034/src/window.c 2022-05-27 17:26:50.546119970 +0100 --- src/window.c 2022-05-28 10:41:34.750534997 +0100 *************** *** 1354,1362 **** p_wh = size; } - // Keep same changelist position in new window. - wp->w_changelistidx = oldwin->w_changelistidx; - /* * make the new window the current window */ --- 1354,1359 ---- *************** *** 1431,1436 **** --- 1428,1437 ---- } newp->w_tagstackidx = oldp->w_tagstackidx; newp->w_tagstacklen = oldp->w_tagstacklen; + + // Keep same changelist position in new window. + newp->w_changelistidx = oldp->w_changelistidx; + #ifdef FEAT_FOLDING copyFoldingState(oldp, newp); #endif *** ../vim-8.2.5034/src/testdir/test_changelist.vim 2022-04-10 17:59:23.343015280 +0100 --- src/testdir/test_changelist.vim 2022-05-28 10:41:34.746534998 +0100 *************** *** 1,5 **** --- 1,40 ---- " Tests for the changelist functionality + " When splitting a window the changelist position is wrong. + " Test the changelist position after splitting a window. + " Test for the bug fixed by 7.4.386 + func Test_changelist() + let save_ul = &ul + enew! + call append('$', ['1', '2']) + exe "normal i\u" + exe "normal Gkylpa\u" + set ul=100 + exe "normal Gylpa\u" + set ul=100 + normal gg + vsplit + normal g; + call assert_equal([3, 2], [line('.'), col('.')]) + normal g; + call assert_equal([2, 2], [line('.'), col('.')]) + call assert_fails('normal g;', 'E662:') + new + call assert_fails('normal g;', 'E664:') + %bwipe! + let &ul = save_ul + endfunc + + " Moving a split should not change its changelist index. + func Test_changelist_index_move_split() + exe "norm! iabc\u\ndef\u\nghi" + vsplit + normal 99g; + call assert_equal(0, getchangelist('%')[1]) + wincmd L + call assert_equal(0, getchangelist('%')[1]) + endfunc + " Tests for the getchangelist() function func Test_changelist_index() edit Xfile1.txt *** ../vim-8.2.5034/src/testdir/test_normal.vim 2022-04-03 12:59:29.358392492 +0100 --- src/testdir/test_normal.vim 2022-05-28 10:41:34.746534998 +0100 *************** *** 3228,3258 **** enew! endfunc - " When splitting a window the changelist position is wrong. - " Test the changelist position after splitting a window. - " Test for the bug fixed by 7.4.386 - func Test_changelist() - let save_ul = &ul - enew! - call append('$', ['1', '2']) - exe "normal i\u" - exe "normal Gkylpa\u" - set ul=100 - exe "normal Gylpa\u" - set ul=100 - normal gg - vsplit - normal g; - call assert_equal([3, 2], [line('.'), col('.')]) - normal g; - call assert_equal([2, 2], [line('.'), col('.')]) - call assert_fails('normal g;', 'E662:') - new - call assert_fails('normal g;', 'E664:') - %bwipe! - let &ul = save_ul - endfunc - func Test_nv_hat_count() %bwipeout! let l:nr = bufnr('%') + 1 --- 3228,3233 ---- *** ../vim-8.2.5034/src/version.c 2022-05-27 21:57:51.943739826 +0100 --- src/version.c 2022-05-28 10:43:42.494467138 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5035, /**/ -- Overflow on /dev/null, please empty the bit bucket. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///