Hi Bram and list,

2016-10-27(Thu) 21:50:11 UTC+9 Bram Moolenaar:
> Patch 8.0.0047
> Problem:    Crash when using the preview window from an unnamed buffer.
>             (lifepillar)
> Solution:   Do not clear the wrong buffer. (closes #1200)
> Files:      src/popupmnu.c
> 
> 
> *** ../vim-8.0.0046/src/popupmnu.c    2016-08-29 22:42:20.000000000 +0200
> --- src/popupmnu.c    2016-10-27 14:29:30.530187340 +0200
> ***************
> *** 582,588 ****
>   
>           if (curwin->w_p_pvw)
>           {
> !             if (curbuf->b_fname == NULL
>                       && curbuf->b_p_bt[0] == 'n' && curbuf->b_p_bt[2] == 'f'
>                       && curbuf->b_p_bh[0] == 'w')
>               {
> --- 582,590 ----
>   
>           if (curwin->w_p_pvw)
>           {
> !             if (!resized
> !                     && curbuf->b_nwindows == 1
> !                     && curbuf->b_fname == NULL
>                       && curbuf->b_p_bt[0] == 'n' && curbuf->b_p_bt[2] == 'f'
>                       && curbuf->b_p_bh[0] == 'w')
>               {
> *** ../vim-8.0.0046/src/version.c     2016-10-21 20:35:32.632943225 +0200
> --- src/version.c     2016-10-27 14:48:11.623357275 +0200
> ***************
> *** 766,767 ****
> --- 766,769 ----
>   {   /* Add new patch number below this line */
> + /**/
> +     47,
>   /**/

Here is a test patch for this.
I confirmed fails unpatched my patch, and success patched one.

--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index cc93ff8..f1e2c98 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -378,7 +378,7 @@ func DummyCompleteFour(findstart, base)
   endif
 endfunc
 
-" Test that 'completefunc' works when it's OK.
+" Test that 'omnifunc' works when it's OK.
 func Test_omnifunc_with_check()
   new
   setlocal omnifunc=DummyCompleteFour
@@ -437,5 +437,31 @@ func Test_complete_no_undo()
   q!
 endfunc
 
+function! DummyCompleteFive(findstart, base)
+  if a:findstart
+    return 0
+  else
+    return [
+          \   { 'word': 'January', 'info': "info1-1\n1-2\n1-3" },
+          \   { 'word': 'February', 'info': "info2-1\n2-2\n2-3" },
+          \   { 'word': 'March', 'info': "info3-1\n3-2\n3-3" },
+          \   { 'word': 'April', 'info': "info4-1\n4-2\n4-3" },
+          \   { 'word': 'May', 'info': "info5-1\n5-2\n5-3" },
+          \ ]
+  endif
+endfunc
+
+" Test that 'completefunc' on Scratch buffer with preview window works when
+" it's OK.
+func Test_completefunc_with_scratch_buffer()
+  new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
+  set completeopt+=preview
+  setlocal completefunc=DummyCompleteFive
+  call feedkeys("A\<C-X>\<C-U>\<C-N>\<C-N>\<C-N>\<Esc>", "x")
+  call assert_equal(['April'], getline(1, '$'))
+  pclose
+  q!
+  set completeopt&
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab

Raspunde prin e-mail lui