To: vim_dev@googlegroups.com Subject: Patch 8.0.1816 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1816 Problem: No test for setcmdpos(). Solution: Add a test. (Dominique Pelle, closes #2901) Files: src/testdir/test_cmdline.vim *** ../vim-8.0.1815/src/testdir/test_cmdline.vim 2018-05-01 19:23:40.777975258 +0200 --- src/testdir/test_cmdline.vim 2018-05-12 13:15:47.948953255 +0200 *************** *** 470,473 **** --- 470,494 ---- call delete('Xlog') endfunc + func Test_setcmdpos() + func InsertTextAtPos(text, pos) + call assert_equal(0, setcmdpos(a:pos)) + return a:text + endfunc + + " setcmdpos() with position in the middle of the command line. + call feedkeys(":\"12\=InsertTextAtPos('a', 3)\b\", 'xt') + call assert_equal('"1ab2', @:) + + call feedkeys(":\"12\\=InsertTextAtPos('a', 3)\b\", 'xt') + call assert_equal('"1b2a', @:) + + " setcmdpos() with position beyond the end of the command line. + call feedkeys(":\"12\\=InsertTextAtPos('a', 10)\b\", 'xt') + call assert_equal('"12ab', @:) + + " setcmdpos() returns 1 when not editing the command line. + call assert_equal(1, setcmdpos(3)) + endfunc + set cpo& *** ../vim-8.0.1815/src/version.c 2018-05-11 22:01:47.089458032 +0200 --- src/version.c 2018-05-12 13:18:34.876041188 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1816, /**/ -- Save the plankton - eat a whale. /// 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 ///