0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

updated for version 7.0-062

This commit is contained in:
Bram Moolenaar
2006-08-16 19:41:08 +00:00
parent f83c5c0113
commit 968bbbe436
5 changed files with 34 additions and 1 deletions

View File

@@ -1777,6 +1777,27 @@ get_menu_mode()
return MENU_INDEX_INVALID; return MENU_INDEX_INVALID;
} }
/*
* Check that a pointer appears in the menu tree. Used to protect from using
* a menu that was deleted after it was selected but before the event was
* handled.
* Return OK or FAIL. Used recursively.
*/
int
check_menu_pointer(root, menu_to_check)
vimmenu_T *root;
vimmenu_T *menu_to_check;
{
vimmenu_T *p;
for (p = root; p != NULL; p = p->next)
if (p == menu_to_check
|| (p->children != NULL
&& check_menu_pointer(p->children, menu_to_check) == OK))
return OK;
return FAIL;
}
/* /*
* After we have started the GUI, then we can create any menus that have been * After we have started the GUI, then we can create any menus that have been
* defined. This is done once here. add_menu_path() may have already been * defined. This is done once here. add_menu_path() may have already been

View File

@@ -2504,7 +2504,8 @@ do_mouse(oap, c, dir, count, fixindent)
* NOTE: Ignore right button down and drag mouse events. * NOTE: Ignore right button down and drag mouse events.
* Windows only shows the popup menu on the button up event. * Windows only shows the popup menu on the button up event.
*/ */
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
|| defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
if (!is_click) if (!is_click)
return FALSE; return FALSE;
#endif #endif

View File

@@ -10,6 +10,7 @@ extern int menu_is_popup __ARGS((char_u *name));
extern int menu_is_child_of_popup __ARGS((vimmenu_T *menu)); extern int menu_is_child_of_popup __ARGS((vimmenu_T *menu));
extern int menu_is_toolbar __ARGS((char_u *name)); extern int menu_is_toolbar __ARGS((char_u *name));
extern int menu_is_separator __ARGS((char_u *name)); extern int menu_is_separator __ARGS((char_u *name));
extern int check_menu_pointer __ARGS((vimmenu_T *root, vimmenu_T *menu_to_check));
extern void gui_create_initial_menus __ARGS((vimmenu_T *menu)); extern void gui_create_initial_menus __ARGS((vimmenu_T *menu));
extern void gui_update_menus __ARGS((int modes)); extern void gui_update_menus __ARGS((int modes));
extern int gui_is_menu_shortcut __ARGS((int key)); extern int gui_is_menu_shortcut __ARGS((int key));

View File

@@ -4783,6 +4783,14 @@ check_termcode(max_offset, buf, buflen)
return -1; return -1;
current_menu = (vimmenu_T *)val; current_menu = (vimmenu_T *)val;
slen += num_bytes; slen += num_bytes;
/* The menu may have been deleted right after it was used, check
* for that. */
if (check_menu_pointer(root_menu, current_menu) == FAIL)
{
key_name[0] = KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
}
} }
# endif # endif
# ifdef FEAT_GUI_TABLINE # ifdef FEAT_GUI_TABLINE

View File

@@ -666,6 +666,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
62,
/**/ /**/
61, 61,
/**/ /**/