To: vim_dev@googlegroups.com Subject: Patch 8.0.0347 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0347 Problem: When using CTRL-X CTRL-U inside a comment, the use of the comment leader may not work. (Klement) Solution: Save and restore did_ai. (Christian Brabandt, closes #1494) Files: src/edit.c, src/testdir/test_popup.vim *** ../vim-8.0.0346/src/edit.c 2017-02-19 15:26:14.353270128 +0100 --- src/edit.c 2017-02-21 22:56:12.180695294 +0100 *************** *** 5095,5100 **** --- 5095,5101 ---- int n; int save_w_wrow; int insert_match; + int save_did_ai = did_ai; compl_direction = ins_compl_key2dir(c); insert_match = ins_compl_use_match(c); *************** *** 5378,5383 **** --- 5379,5386 ---- { EMSG2(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION ? "completefunc" : "omnifunc"); + /* restore did_ai, so that adding comment leader works */ + did_ai = save_did_ai; return FAIL; } *** ../vim-8.0.0346/src/testdir/test_popup.vim 2017-02-19 15:26:14.353270128 +0100 --- src/testdir/test_popup.vim 2017-02-21 23:00:14.523126264 +0100 *************** *** 551,554 **** --- 551,573 ---- iunmap endfunc + func Test_completion_comment_formatting() + new + setl formatoptions=tcqro + call feedkeys("o/*\\/\", 'tx') + call assert_equal(['', '/*', ' *', ' */'], getline(1,4)) + %d + call feedkeys("o/*\foobar\/\", 'tx') + call assert_equal(['', '/*', ' * foobar', ' */'], getline(1,4)) + %d + try + call feedkeys("o/*\\\\/\", 'tx') + call assert_false(1, 'completefunc not set, should have failed') + catch + call assert_exception('E764:') + endtry + call assert_equal(['', '/*', ' *', ' */'], getline(1,4)) + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.0.0346/src/version.c 2017-02-21 21:57:02.475629988 +0100 --- src/version.c 2017-02-21 22:54:36.357315473 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 347, /**/ -- It's totally unfair to suggest - as many have - that engineers are socially inept. Engineers simply have different objectives when it comes to social interaction. (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 ///