diff src/testdir/test_popup.vim @ 12690:fad36581f788 v8.0.1223

patch 8.0.1223: crash when using autocomplete and tab pages commit https://github.com/vim/vim/commit/9ad89c6c4f89cd710d8244d8010b8b0ae30ba79d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 26 22:04:04 2017 +0200 patch 8.0.1223: crash when using autocomplete and tab pages Problem: Crash when using autocomplete and tab pages. Solution: Check if the current tab changed. (Christian Brabandt, closes #2239)
author Christian Brabandt <cb@256bit.org>
date Thu, 26 Oct 2017 22:15:05 +0200
parents 1fad9675d8fd
children 6daad7ef16be
line wrap: on
line diff
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -661,4 +661,41 @@ func Test_popup_and_window_resize()
   bwipe!
 endfunc
 
+func Test_popup_and_preview_autocommand()
+  " This used to crash Vim
+  if !has('python')
+    return
+  endif
+  let h = winheight(0)
+  if h < 15
+    return
+  endif
+  new
+  augroup MyBufAdd
+    au!
+    au BufAdd * nested tab sball
+  augroup END
+  set omnifunc=pythoncomplete#Complete
+  call setline(1, 'import os')
+  " make the line long
+  call setline(2, '                                 os.')
+  $
+  call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<enter>\<esc>", 'tx')
+  call assert_equal(["import os", "                                 os.EX_IOERR", ''], getline(1,'$'))
+  call assert_equal(1, winnr('$'))
+  " previewwindow option is not set
+  call assert_equal(0, &previewwindow)
+  norm! gt
+  call assert_equal(0, &previewwindow)
+  norm! gT
+  call assert_equal(12, tabpagenr('$'))
+  tabonly
+  pclose
+  augroup MyBufAdd
+    au!
+  augroup END
+  augroup! MyBufAdd
+  bw!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab