Skip to content

Commit 6abe5e4

Browse files
h-eastzeertzjq
authored andcommitted
patch 9.1.1601: Patch v8.1.0425 was wrong
Problem: Patch v8.1.0425 was wrong Solution: Revert that patch (Hirohito Higashi) This is because the root cause was fixed in 8.1.0786 and a regression occurred elsewhere. related: #3455 related: #3830 fixes: #11558 closes: #17899 Co-authored-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Hirohito Higashi <h.east.727@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent c849b17 commit 6abe5e4

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

src/buffer.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,9 +2003,6 @@ enter_buffer(buf_T *buf)
20032003
// mark cursor position as being invalid
20042004
curwin->w_valid = 0;
20052005

2006-
buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum,
2007-
curbuf->b_last_cursor.col, TRUE);
2008-
20092006
// Make sure the buffer is loaded.
20102007
if (curbuf->b_ml.ml_mfp == NULL) // need to load the file
20112008
{

src/testdir/test_buffer.vim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,4 +613,31 @@ func Test_closed_buffer_still_in_window()
613613
%bw!
614614
endfunc
615615

616+
" Cursor position should be restored when switching to a buffer previously
617+
" viewed in a window, regardless of whether it's visible in another one.
618+
func Test_switch_to_previously_viewed_buffer()
619+
set nostartofline
620+
new Xviewbuf
621+
call setline(1, range(1, 200))
622+
let oldwin = win_getid()
623+
vsplit
624+
625+
call cursor(100, 3)
626+
edit Xotherbuf
627+
buffer Xviewbuf
628+
call assert_equal([0, 100, 3, 0], getpos('.'))
629+
630+
exe win_id2win(oldwin) .. 'close'
631+
setlocal bufhidden=hide
632+
633+
call cursor(200, 3)
634+
edit Xotherbuf
635+
buffer Xviewbuf
636+
call assert_equal([0, 200, 3, 0], getpos('.'))
637+
638+
bwipe! Xotherbuf
639+
bwipe! Xviewbuf
640+
set startofline&
641+
endfunc
642+
616643
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
1601,
722724
/**/
723725
1600,
724726
/**/

0 commit comments

Comments
 (0)