To: vim_dev@googlegroups.com Subject: Patch 9.0.0081 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0081 Problem: Command line completion of user command may have duplicates. (Dani Dickstein) Solution: Skip global user command if an identical buffer-local one is defined. (closes #10797) Files: src/usercmd.c, src/testdir/test_cmdline.vim *** ../vim-9.0.0080/src/usercmd.c 2022-07-03 13:15:57.988497914 +0100 --- src/usercmd.c 2022-07-26 17:22:37.186218546 +0100 *************** *** 363,371 **** if (idx < buf->b_ucmds.ga_len) return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name; idx -= buf->b_ucmds.ga_len; if (idx < ucmds.ga_len) ! return USER_CMD(idx)->uc_name; return NULL; } --- 363,381 ---- if (idx < buf->b_ucmds.ga_len) return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name; + idx -= buf->b_ucmds.ga_len; if (idx < ucmds.ga_len) ! { ! int i; ! char_u *name = USER_CMD(idx)->uc_name; ! ! for (i = 0; i < buf->b_ucmds.ga_len; ++i) ! if (STRCMP(name, USER_CMD_GA(&buf->b_ucmds, i)->uc_name) == 0) ! // global command is overruled by buffer-local one ! return (char_u *)""; ! return name; ! } return NULL; } *** ../vim-9.0.0080/src/testdir/test_cmdline.vim 2022-07-02 16:29:15.027193547 +0100 --- src/testdir/test_cmdline.vim 2022-07-26 17:22:22.318278732 +0100 *************** *** 842,847 **** --- 842,857 ---- delcommand Foo endfunc + func Test_complete_user_cmd() + command FooBar echo 'global' + command -buffer FooBar echo 'local' + call feedkeys(":Foo\\\"\", 'tx') + call assert_equal('"FooBar', @:) + + delcommand -buffer FooBar + delcommand FooBar + endfunc + func s:ScriptLocalFunction() echo 'yes' endfunc *** ../vim-9.0.0080/src/version.c 2022-07-26 16:03:35.182058189 +0100 --- src/version.c 2022-07-26 17:23:27.226016399 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 81, /**/ -- hundred-and-one symptoms of being an internet addict: 136. You decide to stay in a low-paying job teaching just for the free Internet access. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///