]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0515: ml_get errors in silent Ex mode v8.0.0515
authorBram Moolenaar <Bram@vim.org>
Mon, 27 Mar 2017 21:02:07 +0000 (23:02 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 27 Mar 2017 21:02:07 +0000 (23:02 +0200)
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.

src/ex_docmd.c
src/move.c
src/testdir/test_startup.vim
src/version.c

index 8755f0549b02f21521e7e75ea36eece7c853ea81..dd5e0a8c40dbadc5ac10adb179ed4bd058129578 100644 (file)
@@ -10361,6 +10361,7 @@ ex_normal(exarg_T *eap)
            {
                curwin->w_cursor.lnum = eap->line1++;
                curwin->w_cursor.col = 0;
+               check_cursor_moved(curwin);
            }
 
            exec_normal_cmd(
index 3d6d2ec8f4200be3554928373776255efc7695f7..f058b731063ff83d1dfd1128a1c3787e3d8b7460 100644 (file)
@@ -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
index 9d591385fbf2b0c1ef3fd761c75a50877d8e3f61..2b003c7cf8d0c005bbb6fadf9c2f60c2676af812 100644 (file)
@@ -197,3 +197,14 @@ func Test_progpath()
   " Only expect "vim" to appear in v:progname.
   call assert_match('vim\c', v:progname)
 endfunc
+
+func Test_silent_ex_mode()
+  if !has('unix') || has('gui_running')
+    " can't get output of Vim.
+    return
+  endif
+
+  " This caused an ml_get error.
+  let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq')
+  call assert_notmatch('E315:', out)
+endfunc
index 79c97f9b96e8611fba1c81d69cf6754c7fa75047..c114d8f55b55061cf9a003065cb14c5cbd04aeac 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    515,
 /**/
     514,
 /**/