diff src/move.c @ 11258:84f71a8a5f2c v8.0.0515

patch 8.0.0515: ml_get errors in silent Ex mode commit https://github.com/vim/vim/commit/d5d37537d1fa46fd468bd378af2006dd09840f38 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 27 23:02:07 2017 +0200 patch 8.0.0515: ml_get errors in silent Ex mode Problem: ml_get errors in silent Ex mode. (Dominique Pelle) Solution: Clear valid flags when setting the cursor. Set the topline when not in full screen mode.
author Christian Brabandt <cb@256bit.org>
date Mon, 27 Mar 2017 23:15:05 +0200
parents 778c10516955
children 69af108df70e
line wrap: on
line diff
--- a/src/move.c
+++ b/src/move.c
@@ -177,11 +177,9 @@ update_topline(void)
     int		save_so = p_so;
 #endif
 
-    if (!screen_valid(TRUE))
-	return;
-
-    /* If the window height is zero just use the cursor line. */
-    if (curwin->w_height == 0)
+    /* If there is no valid screen and when the window height is zero just use
+     * the cursor line. */
+    if (!screen_valid(TRUE) || curwin->w_height == 0)
     {
 	curwin->w_topline = curwin->w_cursor.lnum;
 	curwin->w_botline = curwin->w_topline;
@@ -2592,6 +2590,7 @@ halfpage(int flag, linenr_T Prenum)
     n = (curwin->w_p_scr <= curwin->w_height) ?
 				    curwin->w_p_scr : curwin->w_height;
 
+    update_topline();
     validate_botline();
     room = curwin->w_empty_rows;
 #ifdef FEAT_DIFF