diff src/structs.h @ 16401:3b2db762a509 v8.1.1205

patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move commit https://github.com/vim/vim/commit/a68e59590905da9b4448ff1fcac929ad1a18da9e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 25 22:22:01 2019 +0200 patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move Problem: A BufReadPre autocommand may cause the cursor to move. Solution: Restore the cursor position after executing the autocommand, unless the autocommand moved it. (Christian Brabandt, closes #4302, closes #4294)
author Bram Moolenaar <Bram@vim.org>
date Thu, 25 Apr 2019 22:30:05 +0200
parents abb67309c1ca
children 5b5c5daf57de
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -2715,6 +2715,16 @@ struct matchitem
 #endif
 };
 
+// Structure to store last cursor position and topline.  Used by check_lnums()
+// and reset_lnums().
+typedef struct
+{
+    int		w_topline_save;	// original topline value
+    int		w_topline_corr;	// corrected topline value
+    pos_T	w_cursor_save;	// original cursor position
+    pos_T	w_cursor_corr;	// corrected cursor position
+} pos_save_T;
+
 #ifdef FEAT_MENU
 typedef struct {
     int		wb_startcol;
@@ -2803,6 +2813,8 @@ struct window_S
     int		w_wincol;	    /* Leftmost column of window in screen. */
     int		w_width;	    /* Width of window, excluding separation. */
     int		w_vsep_width;	    /* Number of separator columns (0 or 1). */
+    pos_save_T	w_save_cursor;	    /* backup of cursor pos and topline */
+
 
     /*
      * === start of cached values ====