]> granicus.if.org Git - vim/commitdiff
patch 8.0.0762: ml_get error with :psearch in buffer without a name v8.0.0762
authorBram Moolenaar <Bram@vim.org>
Sun, 23 Jul 2017 20:02:02 +0000 (22:02 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 23 Jul 2017 20:02:02 +0000 (22:02 +0200)
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.

src/Makefile
src/search.c
src/testdir/Make_all.mak
src/testdir/test_preview.vim [new file with mode: 0644]
src/version.c

index dcb92039589bba8974d47da2aeee04576465ba45..e522c78c481c9bad64dd32458e78e8a5fb3b79ea 100644 (file)
@@ -2216,6 +2216,7 @@ test_arglist \
        test_perl \
        test_plus_arg_edit \
        test_popup \
+       test_preview \
        test_profile \
        test_put \
        test_python2 \
index ac1192725adf1f77491c1f2b60a471cda228d0ef..79cd50a77bc0cfbfec4ffb993be69823ec41dd8d 100644 (file)
@@ -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
                    {
index 36279d82b1ce1b5731508fa6b00f37e87340f7e3..1f8d307290ea2a9828912da545a1350dca46827b 100644 (file)
@@ -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 (file)
index 0000000..91923fb
--- /dev/null
@@ -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
index 2d8079c6ae7cfa206e2a68038aa367927eb27ea2..c344072812c0c66d6e8f3b52a467814926fc10db 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    762,
 /**/
     761,
 /**/