From 29a2c08d792e4458a0af8371f5341394829fce29 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 5 Mar 2018 21:06:23 +0100 Subject: 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. --- src/menu.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/menu.c') diff --git a/src/menu.c b/src/menu.c index 107cabce6..c04cd49bb 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1891,6 +1891,16 @@ get_menu_mode(void) return MENU_INDEX_INVALID; } + int +get_menu_mode_flag(void) +{ + int mode = get_menu_mode(); + + if (mode == MENU_INDEX_INVALID) + return 0; + return 1 << mode; +} + /* * Display the Special "PopUp" menu as a pop-up at the current mouse * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode, @@ -2044,13 +2054,7 @@ gui_update_menus(int modes) if (modes != 0x0) mode = modes; else - { - mode = get_menu_mode(); - if (mode == MENU_INDEX_INVALID) - mode = 0; - else - mode = (1 << mode); - } + mode = get_menu_mode_flag(); if (force_menu_update || mode != prev_mode) { -- cgit v1.2.1