Skip to content

Commit c31f9ae

Browse files
committed
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.
1 parent 1f2903c commit c31f9ae

5 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,7 @@ test_arglist \
22162216
test_perl \
22172217
test_plus_arg_edit \
22182218
test_popup \
2219+
test_preview \
22192220
test_profile \
22202221
test_put \
22212222
test_python2 \

src/search.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5425,14 +5425,15 @@ find_pattern_in_path(
54255425
if (g_do_tagpreview != 0)
54265426
{
54275427
if (!GETFILE_SUCCESS(getfile(
5428-
0, curwin_save->w_buffer->b_fname,
5428+
curwin_save->w_buffer->b_fnum, NULL,
54295429
NULL, TRUE, lnum, FALSE)))
54305430
break; /* failed to jump to file */
54315431
}
54325432
else
54335433
#endif
54345434
setpcmark();
54355435
curwin->w_cursor.lnum = lnum;
5436+
check_cursor();
54365437
}
54375438
else
54385439
{

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ NEW_TESTS = test_arabic.res \
175175
test_packadd.res \
176176
test_paste.res \
177177
test_perl.res \
178+
test_preview.res \
178179
test_profile.res \
179180
test_python2.res \
180181
test_python3.res \

src/testdir/test_preview.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
" Tests for the preview window
2+
3+
func Test_Psearch()
4+
" this used to cause ml_get errors
5+
help
6+
let wincount = winnr('$')
7+
0f
8+
ps.
9+
call assert_equal(wincount + 1, winnr('$'))
10+
pclose
11+
call assert_equal(wincount, winnr('$'))
12+
bwipe
13+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
762,
772774
/**/
773775
761,
774776
/**/

0 commit comments

Comments
 (0)