Describe the bug
:tmenu does not show menu tip in GTK3 X11 GUI
To Reproduce
Following :tmenu documentation:
gvim --clean:amenu MyMenu.Hello :echo "Hello"<CR>:tmenu MyMenu.Hello Displays a greeting.Expected behavior
Tip is shown in the command-line area when the mouse is over that item.
Environment (please complete the following information):
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
I tried with 8.2.2000 - can repro this bug.
Also, test test_menu.vim (make test_menu) passes - seems broken test?
PS:
I tried to build earlier vim versions 8.2.0000, 8.2.0500, 8.2.1000 - but they all fail to compile with different python interpreter related errors (tried both python 3.9 and 3.7 with pipenv)
This patch adds menu item tooltips & prints message at bottom of the screen. The part around msg() call is wrong though, but it works. Would appreciate any help on how to improve the patch.
diff --git a/src/gui_gtk.c b/src/gui_gtk.c index 48910b287..1cd21ef4d 100644 --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -684,6 +684,20 @@ menu_item_activate(GtkWidget *widget UNUSED, gpointer data) gui_menu_cb((vimmenu_T *)data); } + static void +menu_item_select(GtkWidget *widget UNUSED, gpointer data) +{ + char_u *tooltip; + vimmenu_T *menu; + + menu = (vimmenu_T *)data; + tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); + if (tooltip != NULL) + msg(tooltip); + else + msg(""); +} + void gui_mch_add_menu_item(vimmenu_T *menu, int idx) { @@ -799,9 +813,12 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id), menu->id, idx); - if (menu->id != NULL) + if (menu->id != NULL) { g_signal_connect(G_OBJECT(menu->id), "activate", G_CALLBACK(menu_item_activate), menu); + g_signal_connect(G_OBJECT(menu->id), "select", + G_CALLBACK(menu_item_select), menu); + } } } #endif // FEAT_MENU @@ -892,8 +909,7 @@ get_menu_position(vimmenu_T *menu) void gui_mch_menu_set_tip(vimmenu_T *menu) { - if (menu->id != NULL && menu->parent != NULL - && gui.toolbar != NULL && menu_is_toolbar(menu->parent->name)) + if (menu->id != NULL && menu->parent != NULL && gui.toolbar != NULL) { char_u *tooltip;