summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-03-15 16:13:53 +0100
committerBram Moolenaar <Bram@vim.org>2020-03-15 16:13:53 +0100
commit0eabd4dc8ff50658f0ea0e92c7918a42242f6b80 (patch)
tree42ea6e7acf72ad4fd46d6e3aad8e1f78f3867c79 /runtime
parent5e4d1eba9579ea6b876ad699d77742e657505d35 (diff)
patch 8.2.0385: menu functionality insufficiently testedv8.2.0385
Problem: Menu functionality insufficiently tested. Solution: Add tests. Add menu_info(). (Yegappan Lakshmanan, closes #5760)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt62
-rw-r--r--runtime/doc/gui.txt4
-rw-r--r--runtime/doc/usr_41.txt3
3 files changed, 67 insertions, 2 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 5dfc08ea48..e3bb34eb7a 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2601,6 +2601,7 @@ matchstr({expr}, {pat} [, {start} [, {count}]])
matchstrpos({expr}, {pat} [, {start} [, {count}]])
List {count}'th match of {pat} in {expr}
max({expr}) Number maximum value of items in {expr}
+menu_info({name} [, {mode}]) Dict get menu item information
min({expr}) Number minimum value of items in {expr}
mkdir({name} [, {path} [, {prot}]])
Number create directory {name}
@@ -7124,6 +7125,7 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
Can also be used as a |method|: >
GetText()->matchstrpos('word')
<
+
*max()*
max({expr}) Return the maximum value of all items in {expr}.
{expr} can be a List or a Dictionary. For a Dictionary,
@@ -7135,6 +7137,66 @@ max({expr}) Return the maximum value of all items in {expr}.
Can also be used as a |method|: >
mylist->max()
+
+menu_info({name} [, {mode}]) *menu_info()*
+ Return information about the specified menu {name} in
+ mode {mode}. The menu name should be specified without the
+ shortcut character ('&').
+
+ {mode} can be one of these strings:
+ "n" Normal
+ "v" Visual (including Select)
+ "o" Operator-pending
+ "i" Insert
+ "c" Cmd-line
+ "s" Select
+ "x" Visual
+ "t" Terminal-Job
+ "" Normal, Visual and Operator-pending
+ "!" Insert and Cmd-line
+ When {mode} is omitted, the modes for "" are used.
+
+ Returns a |Dictionary| containing the following items:
+ accel menu item accelerator text |menu-text|
+ display display name (name without '&')
+ enabled v:true if this menu item is enabled
+ Refer to |:menu-enable|
+ icon name of the icon file (for toolbar)
+ |toolbar-icon|
+ iconidx index of a built-in icon
+ modes modes for which the menu is defined. In
+ addition to the modes mentioned above, these
+ characters will be used:
+ " " Normal, Visual and Operator-pending
+ name menu item name.
+ noremenu v:true if the {rhs} of the menu item is not
+ remappable else v:false.
+ priority menu order priority |menu-priority|
+ rhs right-hand-side of the menu item. The returned
+ string has special characters translated like
+ in the output of the ":menu" command listing.
+ When the {rhs} of a menu item is empty, then
+ "<Nop>" is returned.
+ script v:true if script-local remapping of {rhs} is
+ allowed else v:false. See |:menu-script|.
+ shortcut shortcut key (character after '&' in
+ the menu name) |menu-shortcut|
+ silent v:true if the menu item is created
+ with <silent> argument |:menu-silent|
+ submenus |List| containing the names of
+ all the submenus. Present only if the menu
+ item has submenus.
+
+ Returns an empty dictionary if the menu item is not found.
+
+ Examples: >
+ :echo maparg('Edit.Cut')
+ :echo maparg('File.Save', 'n')
+<
+ Can also be used as a |method|: >
+ GetMenuName()->maparg('v')
+
+
< *min()*
min({expr}) Return the minimum value of all items in {expr}.
{expr} can be a List or a Dictionary. For a Dictionary,
diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt
index 1a38496040..41e20b1060 100644
--- a/runtime/doc/gui.txt
+++ b/runtime/doc/gui.txt
@@ -578,9 +578,11 @@ tooltips for menus. See |terminal-typing|.
Special characters in a menu name:
+ *menu-shortcut*
& The next character is the shortcut key. Make sure each
shortcut key is only used once in a (sub)menu. If you want to
insert a literal "&" in the menu name use "&&".
+ *menu-text*
<Tab> Separates the menu name from right-aligned text. This can be
used to show the equivalent typed command. The text "<Tab>"
can be used here for convenience. If you are using a real
@@ -954,7 +956,7 @@ item for the keyword under the cursor. The register "z" is used. >
mappings, or put these lines in your gvimrc; "<C-R>" is CTRL-R, "<CR>" is
the <CR> key. |<>|)
-
+ *tooltips* *menu-tips*
5.8 Tooltips & Menu tips
See section |42.4| in the user manual.
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 1bed01f418..dfd64c85f2 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -942,10 +942,11 @@ Window size and position: *window-size-functions*
winsaveview() get view of current window
winrestview() restore saved view of current window
-Mappings: *mapping-functions*
+Mappings and Menus: *mapping-functions*
hasmapto() check if a mapping exists
mapcheck() check if a matching mapping exists
maparg() get rhs of a mapping
+ menu_info() get information about a menu item
wildmenumode() check if the wildmode is active
Testing: *test-functions*