• R/O
  • SSH

vim: 提交

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

修訂d53e8428a79a971f28d9ff1a601ef25a0adfe6e2 (tree)
時間2020-03-30 03:15:04
作者Bram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.0478: new buffers are not added to the Buffers menu

Commit: https://github.com/vim/vim/commit/5908fdf72fa1995735e38c46f254ddde81a87c1f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 29 20:08:45 2020 +0200

patch 8.2.0478: new buffers are not added to the Buffers menu
Problem: New buffers are not added to the Buffers menu.
Solution: Turn number into string. (Yee Cheng Chin, closes https://github.com/vim/vim/issues/5864)

Change Summary

差異

diff -r 00d850cecb84 -r d53e8428a79a runtime/menu.vim
--- a/runtime/menu.vim Sun Mar 29 18:45:04 2020 +0200
+++ b/runtime/menu.vim Sun Mar 29 20:15:04 2020 +0200
@@ -2,7 +2,7 @@
22 " You can also use this as a start for your own set of menus.
33 "
44 " Maintainer: Bram Moolenaar <Bram@vim.org>
5-" Last Change: 2020 Mar 19
5+" Last Change: 2020 Mar 29
66
77 " Note that ":an" (short for ":anoremenu") is often used to make a menu work
88 " in all modes and avoid side effects from mappings defined by the user.
@@ -672,7 +672,7 @@
672672 call s:BMShow()
673673 else
674674 let name = expand("<afile>")
675- let num = expand("<abuf>")
675+ let num = expand("<abuf>") + 0 " add zero to convert to a number type
676676 if s:BMCanAdd(name, num)
677677 call <SID>BMFilename(name, num)
678678 let s:bmenu_count += 1
diff -r 00d850cecb84 -r d53e8428a79a src/testdir/test_menu.vim
--- a/src/testdir/test_menu.vim Sun Mar 29 18:45:04 2020 +0200
+++ b/src/testdir/test_menu.vim Sun Mar 29 20:15:04 2020 +0200
@@ -33,10 +33,17 @@
3333
3434 let orig_buffer_menus = execute("nmenu Buffers")
3535
36+ " Test that regular new buffer results in a new buffer menu item.
37+ new
38+ let new_buffer_menus = execute('nmenu Buffers')
39+ call assert_equal(len(split(orig_buffer_menus, "\n")) + 2, len(split(new_buffer_menus, "\n")))
40+ bwipe!
41+ call assert_equal(orig_buffer_menus, execute("nmenu Buffers"))
42+
3643 " Make a new command-line window, test that it does not create a new buffer
3744 " menu.
3845 call feedkeys("q::let cmdline_buffer_menus=execute('nmenu Buffers')\<CR>:q\<CR>", 'ntx')
39- call assert_equal(len(split(orig_buffer_menus, "\n")), len(split(cmdline_buffer_menus, "\n")))
46+ call assert_equal(len(split(orig_buffer_menus, "\n")) + 2, len(split(cmdline_buffer_menus, "\n")))
4047 call assert_equal(orig_buffer_menus, execute("nmenu Buffers"))
4148
4249 if has('terminal')
@@ -44,7 +51,7 @@
4451 " item.
4552 terminal
4653 let term_buffer_menus = execute('nmenu Buffers')
47- call assert_equal(len(split(orig_buffer_menus, "\n")), len(split(term_buffer_menus, "\n")))
54+ call assert_equal(len(split(orig_buffer_menus, "\n")) + 2, len(split(term_buffer_menus, "\n")))
4855 bwipe!
4956 call assert_equal(orig_buffer_menus, execute("nmenu Buffers"))
5057 endif
@@ -155,6 +162,9 @@
155162
156163 " Test for menu item completion in command line
157164 func Test_menu_expand()
165+ " Make sure we don't have stale menu items like Buffers menu.
166+ source $VIMRUNTIME/delmenu.vim
167+
158168 " Create the menu itmes for test
159169 menu Dummy.Nothing lll
160170 for i in range(1, 4)
diff -r 00d850cecb84 -r d53e8428a79a src/version.c
--- a/src/version.c Sun Mar 29 18:45:04 2020 +0200
+++ b/src/version.c Sun Mar 29 20:15:04 2020 +0200
@@ -739,6 +739,8 @@
739739 static int included_patches[] =
740740 { /* Add new patch number below this line */
741741 /**/
742+ 478,
743+/**/
742744 477,
743745 /**/
744746 476,
Show on old repository browser