To: vim_dev@googlegroups.com Subject: Patch 8.0.1223 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1223 Problem: Crash when using autocomplete and tab pages. Solution: Check if the current tab changed. (Christian Brabandt, closes #2239) Files: src/popupmnu.c, src/testdir/test_popup.vim, src/misc1.c *** ../vim-8.0.1222/src/popupmnu.c 2017-09-29 22:42:29.578007992 +0200 --- src/popupmnu.c 2017-10-26 20:38:59.925953086 +0200 *************** *** 566,571 **** --- 566,572 ---- && vim_strchr(p_cot, 'p') != NULL) { win_T *curwin_save = curwin; + tabpage_T *curtab_save = curtab; int res = OK; /* Open a preview window. 3 lines by default. Prefer *************** *** 653,660 **** curwin->w_cursor.lnum = 1; curwin->w_cursor.col = 0; ! if (curwin != curwin_save && win_valid(curwin_save)) { /* When the first completion is done and the preview * window is not resized, skip the preview window's * status line redrawing. */ --- 654,666 ---- curwin->w_cursor.lnum = 1; curwin->w_cursor.col = 0; ! if ((curwin != curwin_save && win_valid(curwin_save)) ! || (curtab != curtab_save ! && valid_tabpage(curtab_save))) { + if (curtab != curtab_save && valid_tabpage(curtab_save)) + goto_tabpage_tp(curtab_save, FALSE, FALSE); + /* When the first completion is done and the preview * window is not resized, skip the preview window's * status line redrawing. */ *** ../vim-8.0.1222/src/testdir/test_popup.vim 2017-10-15 22:07:35.211683156 +0200 --- src/testdir/test_popup.vim 2017-10-26 20:35:55.275222082 +0200 *************** *** 661,664 **** --- 661,701 ---- 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\\\\\\\", '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 *** ../vim-8.0.1222/src/misc1.c 2017-09-22 15:20:27.740148617 +0200 --- src/misc1.c 2017-10-26 20:41:06.033085249 +0200 *************** *** 2313,2319 **** /* Copy bytes after the changed character(s). */ p = newp + col; ! mch_memmove(p + newlen, oldp + col + oldlen, (size_t)(linelen - col - oldlen)); /* Insert or overwrite the new character. */ --- 2313,2320 ---- /* Copy bytes after the changed character(s). */ p = newp + col; ! if (linelen > col + oldlen) ! mch_memmove(p + newlen, oldp + col + oldlen, (size_t)(linelen - col - oldlen)); /* Insert or overwrite the new character. */ *** ../vim-8.0.1222/src/version.c 2017-10-26 21:59:54.004362215 +0200 --- src/version.c 2017-10-26 22:00:42.424023000 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1223, /**/ -- Q: What's orange and sounds like a parrot? A: A carrot /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///