File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,7 +204,8 @@ static void ex_tearoff(exarg_T *eap);
204204#else
205205# define ex_tearoff ex_ni
206206#endif
207- #if (defined(FEAT_GUI_MSWIN ) || defined(FEAT_GUI_GTK )) && defined(FEAT_MENU )
207+ #if (defined(FEAT_GUI_MSWIN ) || defined(FEAT_GUI_GTK ) \
208+ || defined(FEAT_TERM_POPUP_MENU )) && defined(FEAT_MENU )
208209static void ex_popup (exarg_T * eap );
209210#else
210211# define ex_popup ex_ni
@@ -8741,11 +8742,21 @@ ex_tearoff(exarg_T *eap)
87418742}
87428743#endif
87438744
8744- #if (defined(FEAT_GUI_MSWIN ) || defined(FEAT_GUI_GTK )) && defined(FEAT_MENU )
8745+ #if (defined(FEAT_GUI_MSWIN ) || defined(FEAT_GUI_GTK ) \
8746+ || defined(FEAT_TERM_POPUP_MENU )) && defined(FEAT_MENU )
87458747 static void
87468748ex_popup (exarg_T * eap )
87478749{
8748- gui_make_popup (eap -> arg , eap -> forceit );
8750+ # if defined(FEAT_GUI_MSWIN ) || defined(FEAT_GUI_GTK )
8751+ if (gui .in_use )
8752+ gui_make_popup (eap -> arg , eap -> forceit );
8753+ # ifdef FEAT_TERM_POPUP_MENU
8754+ else
8755+ # endif
8756+ # endif
8757+ # ifdef FEAT_TERM_POPUP_MENU
8758+ pum_make_popup (eap -> arg , eap -> forceit );
8759+ # endif
87498760}
87508761#endif
87518762
Original file line number Diff line number Diff line change @@ -1891,6 +1891,16 @@ get_menu_mode(void)
18911891 return MENU_INDEX_INVALID ;
18921892}
18931893
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+
18941904/*
18951905 * Display the Special "PopUp" menu as a pop-up at the current mouse
18961906 * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode,
@@ -2044,13 +2054,7 @@ gui_update_menus(int modes)
20442054 if (modes != 0x0 )
20452055 mode = modes ;
20462056 else
2047- {
2048- mode = get_menu_mode ();
2049- if (mode == MENU_INDEX_INVALID )
2050- mode = 0 ;
2051- else
2052- mode = (1 << mode );
2053- }
2057+ mode = get_menu_mode_flag ();
20542058
20552059 if (force_menu_update || mode != prev_mode )
20562060 {
Original file line number Diff line number Diff line change @@ -1132,12 +1132,16 @@ pum_show_popupmenu(vimmenu_T *menu)
11321132#ifdef FEAT_BEVAL_TERM
11331133 int save_bevalterm = p_bevalterm ;
11341134#endif
1135+ int mode ;
11351136
11361137 pum_undisplay ();
11371138 pum_size = 0 ;
1139+ mode = get_menu_mode_flag ();
11381140
11391141 for (mp = menu -> children ; mp != NULL ; mp = mp -> next )
1140- ++ pum_size ;
1142+ if (menu_is_separator (mp -> dname )
1143+ || (mp -> modes & mp -> enabled & mode ))
1144+ ++ pum_size ;
11411145
11421146 array = (pumitem_T * )alloc_clear ((unsigned )sizeof (pumitem_T ) * pum_size );
11431147 if (array == NULL )
@@ -1146,7 +1150,7 @@ pum_show_popupmenu(vimmenu_T *menu)
11461150 for (mp = menu -> children ; mp != NULL ; mp = mp -> next )
11471151 if (menu_is_separator (mp -> dname ))
11481152 array [idx ++ ].pum_text = (char_u * )"" ;
1149- else
1153+ else if ( mp -> modes & mp -> enabled & mode )
11501154 array [idx ++ ].pum_text = mp -> dname ;
11511155
11521156 pum_array = array ;
@@ -1231,6 +1235,24 @@ pum_show_popupmenu(vimmenu_T *menu)
12311235 p_bevalterm = save_bevalterm ;
12321236 mch_setmouse (TRUE);
12331237# endif
1238+ }
1239+
1240+ void
1241+ pum_make_popup (char_u * path_name , int use_mouse_pos )
1242+ {
1243+ vimmenu_T * menu ;
1244+
1245+ if (!use_mouse_pos )
1246+ {
1247+ /* Hack: set mouse position at the cursor so that the menu pops up
1248+ * around there. */
1249+ mouse_row = curwin -> w_winrow + curwin -> w_wrow ;
1250+ mouse_col = curwin -> w_wincol + curwin -> w_wcol ;
1251+ }
1252+
1253+ menu = gui_find_menu (path_name );
1254+ if (menu != NULL )
1255+ pum_show_popupmenu (menu );
12341256}
12351257# endif
12361258
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ int menu_is_popup(char_u *name);
1212int menu_is_child_of_popup (vimmenu_T * menu );
1313int menu_is_toolbar (char_u * name );
1414int menu_is_separator (char_u * name );
15+ int get_menu_mode_flag (void );
1516void show_popupmenu (void );
1617int check_menu_pointer (vimmenu_T * root , vimmenu_T * menu_to_check );
1718void gui_create_initial_menus (vimmenu_T * menu );
Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ void ui_remove_balloon(void);
1010void ui_post_balloon (char_u * mesg , list_T * list );
1111void ui_may_remove_balloon (void );
1212void pum_show_popupmenu (vimmenu_T * menu );
13+ void pum_make_popup (char_u * path_name , int mouse_pos );
1314/* vim: set ft=c : */
Original file line number Diff line number Diff line change @@ -766,6 +766,8 @@ static char *(features[]) =
766766
767767static int included_patches [] =
768768{ /* Add new patch number below this line */
769+ /**/
770+ 1570 ,
769771/**/
770772 1569 ,
771773/**/
You can’t perform that action at this time.
0 commit comments