]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1601: Patch v8.1.0425 was wrong v9.1.1601
authorHirohito Higashi <h.east.727@gmail.com>
Thu, 7 Aug 2025 13:51:25 +0000 (15:51 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 7 Aug 2025 13:51:25 +0000 (15:51 +0200)
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>
src/buffer.c
src/testdir/test_buffer.vim
src/version.c

index 49db39d8f63e9face2f8e44eba274fdb0c428905..5b66228255b3e7b8b1099bd1b8348394819165c9 100644 (file)
@@ -2003,9 +2003,6 @@ enter_buffer(buf_T *buf)
     // mark cursor position as being invalid
     curwin->w_valid = 0;
 
-    buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum,
-                                             curbuf->b_last_cursor.col, TRUE);
-
     // Make sure the buffer is loaded.
     if (curbuf->b_ml.ml_mfp == NULL)   // need to load the file
     {
index e16a537ef2fc6e53dd7b9fc2aabfbcda8b1c8a07..90b7a9aa43b08650873ae58eac33754d2b1d9def 100644 (file)
@@ -613,4 +613,31 @@ func Test_closed_buffer_still_in_window()
   %bw!
 endfunc
 
+" Cursor position should be restored when switching to a buffer previously
+" viewed in a window, regardless of whether it's visible in another one.
+func Test_switch_to_previously_viewed_buffer()
+  set nostartofline
+  new Xviewbuf
+  call setline(1, range(1, 200))
+  let oldwin = win_getid()
+  vsplit
+
+  call cursor(100, 3)
+  edit Xotherbuf
+  buffer Xviewbuf
+  call assert_equal([0, 100, 3, 0], getpos('.'))
+
+  exe win_id2win(oldwin) .. 'close'
+  setlocal bufhidden=hide
+
+  call cursor(200, 3)
+  edit Xotherbuf
+  buffer Xviewbuf
+  call assert_equal([0, 200, 3, 0], getpos('.'))
+
+  bwipe! Xotherbuf
+  bwipe! Xviewbuf
+  set startofline&
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 3f3f1e1b63ac3ccdd871a316add72aa6414b36e9..3e37609b08a02cb53c0186503e8169ceda58049c 100644 (file)
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1601,
 /**/
     1600,
 /**/