summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-27 23:02:07 +0200
committerBram Moolenaar <Bram@vim.org>2017-03-27 23:02:07 +0200
commitd5d37537d1fa46fd468bd378af2006dd09840f38 (patch)
treea0319f63b4739528379f52ad116b6aa5f78f6b90
parent980128c369451450743bdb90a67588fa72ec4b07 (diff)
downloadvim-git-d5d37537d1fa46fd468bd378af2006dd09840f38.tar.gz
patch 8.0.0515: ml_get errors in silent Ex modev8.0.0515
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.
-rw-r--r--src/ex_docmd.c1
-rw-r--r--src/move.c9
-rw-r--r--src/testdir/test_startup.vim11
-rw-r--r--src/version.c2
4 files changed, 18 insertions, 5 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 8755f0549..dd5e0a8c4 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -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(
diff --git a/src/move.c b/src/move.c
index 3d6d2ec8f..f058b7310 100644
--- 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
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index 9d591385f..2b003c7cf 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 79c97f9b9..c114d8f55 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 515,
+/**/
514,
/**/
513,