diff src/buffer.c @ 14826:75d474a8868a v8.1.0425

patch 8.1.0425: ml_get error and crash with appendbufline() commit https://github.com/vim/vim/commit/9cea87c5775948a35098f3602746c20ecf95dbcd Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 21 16:59:45 2018 +0200 patch 8.1.0425: ml_get error and crash with appendbufline() Problem: ml_get error and crash with appendbufline(). (Masashi Iizuka) Solution: Set per-window buffer info. (Hirohito Higashi, closes https://github.com/vim/vim/issues/3455)
author Christian Brabandt <cb@256bit.org>
date Fri, 21 Sep 2018 17:00:06 +0200
parents 1ae9c8a1b3bf
children 27b9a84395b5
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -428,7 +428,10 @@ can_unload_buffer(buf_T *buf)
 
 	FOR_ALL_WINDOWS(wp)
 	    if (wp->w_buffer == buf)
+	    {
 		can_unload = FALSE;
+		break;
+	    }
     }
     if (!can_unload)
 	EMSG(_("E937: Attempt to delete a buffer that is in use"));
@@ -1742,6 +1745,9 @@ 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 */
     {