summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-07-23 22:02:02 +0200
committerBram Moolenaar <Bram@vim.org>2017-07-23 22:02:02 +0200
commitc31f9ae4f1976544522313b182957793063ee02c (patch)
treeaaade7d671291b0ec853fe0c6a8d44f525d05f05
parent1f2903c43109b16594d141a730659317b15f388d (diff)
downloadvim-c31f9ae4f1976544522313b182957793063ee02c.zip
patch 8.0.0762: ml_get error with :psearch in buffer without a name
Problem: ml_get error with :psearch in buffer without a name. (Dominique Pelle) Solution: Use the buffer number instead of the file name. Check the cursor position.
-rw-r--r--src/Makefile1
-rw-r--r--src/search.c3
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/test_preview.vim13
-rw-r--r--src/version.c2
5 files changed, 19 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index dcb920395..e522c78c4 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2216,6 +2216,7 @@ test_arglist \
test_perl \
test_plus_arg_edit \
test_popup \
+ test_preview \
test_profile \
test_put \
test_python2 \
diff --git a/src/search.c b/src/search.c
index ac1192725..79cd50a77 100644
--- a/src/search.c
+++ b/src/search.c
@@ -5425,7 +5425,7 @@ search_line:
if (g_do_tagpreview != 0)
{
if (!GETFILE_SUCCESS(getfile(
- 0, curwin_save->w_buffer->b_fname,
+ curwin_save->w_buffer->b_fnum, NULL,
NULL, TRUE, lnum, FALSE)))
break; /* failed to jump to file */
}
@@ -5433,6 +5433,7 @@ search_line:
#endif
setpcmark();
curwin->w_cursor.lnum = lnum;
+ check_cursor();
}
else
{
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 36279d82b..1f8d30729 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -175,6 +175,7 @@ NEW_TESTS = test_arabic.res \
test_packadd.res \
test_paste.res \
test_perl.res \
+ test_preview.res \
test_profile.res \
test_python2.res \
test_python3.res \
diff --git a/src/testdir/test_preview.vim b/src/testdir/test_preview.vim
new file mode 100644
index 000000000..91923fb1e
--- /dev/null
+++ b/src/testdir/test_preview.vim
@@ -0,0 +1,13 @@
+" Tests for the preview window
+
+func Test_Psearch()
+ " this used to cause ml_get errors
+ help
+ let wincount = winnr('$')
+ 0f
+ ps.
+ call assert_equal(wincount + 1, winnr('$'))
+ pclose
+ call assert_equal(wincount, winnr('$'))
+ bwipe
+endfunc
diff --git a/src/version.c b/src/version.c
index 2d8079c6a..c34407281 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 762,
+/**/
761,
/**/
760,