Mercurial > vim
comparison src/menu.c @ 13392:d5347779fb20 v8.0.1570
patch 8.0.1570: can't use :popup for a menu in the terminal
commit https://github.com/vim/vim/commit/29a2c08d792e4458a0af8371f5341394829fce29
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 5 21:06:23 2018 +0100
patch 8.0.1570: can't use :popup for a menu in the terminal
Problem: Can't use :popup for a menu in the terminal. (Wei Zhang)
Solution: Make :popup work in the terminal. Also fix that entries were
included that don't work in the current state.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 05 Mar 2018 21:15:05 +0100 |
parents | 69517d67421f |
children | d21899f0d850 |
comparison
equal
deleted
inserted
replaced
13391:6ef2dba73dab | 13392:d5347779fb20 |
---|---|
1889 if (State & LANGMAP) /* must be a "r" command, like Insert mode */ | 1889 if (State & LANGMAP) /* must be a "r" command, like Insert mode */ |
1890 return MENU_INDEX_INSERT; | 1890 return MENU_INDEX_INSERT; |
1891 return MENU_INDEX_INVALID; | 1891 return MENU_INDEX_INVALID; |
1892 } | 1892 } |
1893 | 1893 |
1894 int | |
1895 get_menu_mode_flag(void) | |
1896 { | |
1897 int mode = get_menu_mode(); | |
1898 | |
1899 if (mode == MENU_INDEX_INVALID) | |
1900 return 0; | |
1901 return 1 << mode; | |
1902 } | |
1903 | |
1894 /* | 1904 /* |
1895 * Display the Special "PopUp" menu as a pop-up at the current mouse | 1905 * Display the Special "PopUp" menu as a pop-up at the current mouse |
1896 * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode, | 1906 * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode, |
1897 * etc. | 1907 * etc. |
1898 */ | 1908 */ |
2042 int mode = 0; | 2052 int mode = 0; |
2043 | 2053 |
2044 if (modes != 0x0) | 2054 if (modes != 0x0) |
2045 mode = modes; | 2055 mode = modes; |
2046 else | 2056 else |
2047 { | 2057 mode = get_menu_mode_flag(); |
2048 mode = get_menu_mode(); | |
2049 if (mode == MENU_INDEX_INVALID) | |
2050 mode = 0; | |
2051 else | |
2052 mode = (1 << mode); | |
2053 } | |
2054 | 2058 |
2055 if (force_menu_update || mode != prev_mode) | 2059 if (force_menu_update || mode != prev_mode) |
2056 { | 2060 { |
2057 gui_update_menus_recurse(root_menu, mode); | 2061 gui_update_menus_recurse(root_menu, mode); |
2058 gui_mch_draw_menubar(); | 2062 gui_mch_draw_menubar(); |