To: vim_dev@googlegroups.com Subject: Patch 8.0.0341 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0341 Problem: When using complete() and typing a character undo is saved after the character was inserted. (Shougo) Solution: Save for undo before inserting the character. Files: src/edit.c, src/testdir/test_popup.vim *** ../vim-8.0.0340/src/edit.c 2017-02-17 16:31:16.917294167 +0100 --- src/edit.c 2017-02-19 14:42:14.996457874 +0100 *************** *** 3583,3589 **** --- 3583,3593 ---- { #ifdef FEAT_MBYTE int cc; + #endif + if (stop_arrow() == FAIL) + return; + #ifdef FEAT_MBYTE if (has_mbyte && (cc = (*mb_char2len)(c)) > 1) { char_u buf[MB_MAXBYTES + 1]; *** ../vim-8.0.0340/src/testdir/test_popup.vim 2017-02-09 17:36:59.293629503 +0100 --- src/testdir/test_popup.vim 2017-02-19 14:41:36.000740244 +0100 *************** *** 531,534 **** --- 531,554 ---- bw! endfunc + func CompleteUndo() abort + call complete(1, g:months) + return '' + endfunc + + func Test_completion_can_undo() + inoremap =CompleteUndo() + set completeopt+=noinsert,noselect + + new + call feedkeys("a\a\", 'xt') + call assert_equal('a', getline(1)) + undo + call assert_equal('', getline(1)) + + bwipe! + set completeopt& + iunmap + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.0.0340/src/version.c 2017-02-19 13:54:57.996966935 +0100 --- src/version.c 2017-02-19 14:43:54.619736549 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 341, /**/ -- Engineers will go without food and hygiene for days to solve a problem. (Other times just because they forgot.) (Scott Adams - The Dilbert principle) /// 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 ///