Subject: patch 5.4.27 (was: 5.4 popup menu bug (Win32))
From: Bram Moolenaar <[email-masked]>
To: Mike Steed <[email-masked]>
Cc: [email-masked]

------------

Mike Steed wrote:

>    Here's a problem (unpatched Vim-5.4, pardon me if this has been reported):
> 
>    gvim -u NONE -U NONE
>    :amenu PopUp.Hello :echo 'Hello'^M
>    (popup menu item works)
> 
>    :aunmenu PopUp.Hello
>    (popup menu item still shows up in the menu and works)
> 
>    :aunmenu PopUp.Hello
>    Vim says "No menu of that name".
> 
>    I hope this isn't yet another Win32 oddity that depends on my particular
> version of IE, comctl*, etc., etc.

As Charles Campbell noted, there also is a problem on Motif.  I can reproduce
both.

Hmm, I have it fixed now for Motif, but the menu is still there for Win32.
Perhaps this has something to do with the tear-off items.  Or deleting PopUp
menu items just doesn't work.

Patch 5.4.27
Problem:    Entries in the PopUp[nvic] menus were added for several modes, but
	    only deleted for the mode they were used for.  This resulted in
	    the  entry remaining in the PopUp menu.
	    When removing a PopUp[nvic] menu, the name had been truncated,
	    could result in greying-out the whole PopUp menu.
Solution:   Remove entries for all modes from the PopUp[nvic] menus.  Remove
	    the PopUp[nvic] menu entries first, before the name is changed.
Files:	    src/menu.c

*** ../vim-5.4.26/src/menu.c	Tue Aug 10 16:09:26 1999
--- src/menu.c	Fri Aug 13 22:09:30 1999
***************
*** 139,145 ****
      {
  	if (STRCMP(menu_path, "*") == 0)	/* meaning: remove all menus */
  	    menu_path = (char_u *)"";
- 	remove_menu(&root_menu, menu_path, modes, FALSE);
  
  	/*
  	 * For the PopUp menu, remove a menu for each mode separately.
--- 139,144 ----
***************
*** 152,162 ****
  		    p = popup_mode_name(menu_path, i);
  		    if (p != NULL)
  		    {
! 			remove_menu(&root_menu, p, 1 << i, TRUE);
  			vim_free(p);
  		    }
  		}
  	}
      }
      else
      {
--- 151,164 ----
  		    p = popup_mode_name(menu_path, i);
  		    if (p != NULL)
  		    {
! 			remove_menu(&root_menu, p, MENU_ALL_MODES, TRUE);
  			vim_free(p);
  		    }
  		}
  	}
+ 
+ 	/* Careful: remove_menu() changes menu_path */
+ 	remove_menu(&root_menu, menu_path, modes, FALSE);
      }
      else
      {
*** ../vim-5.4.26/src/version.h	Fri Aug 13 13:12:01 1999
--- src/version.h	Fri Aug 13 22:07:14 1999
***************
*** 19,26 ****
  #define VIM_VERSION_MINOR_STR		"4"
  #define VIM_VERSION_BUILD		 57
  #define VIM_VERSION_BUILD_STR		"57"
! #define VIM_VERSION_PATCHLEVEL		 26
! #define VIM_VERSION_PATCHLEVEL_STR	"26"
  
  /*
   * VIM_VERSION_NODOT is used for the runtime directory name.
--- 19,26 ----
  #define VIM_VERSION_MINOR_STR		"4"
  #define VIM_VERSION_BUILD		 57
  #define VIM_VERSION_BUILD_STR		"57"
! #define VIM_VERSION_PATCHLEVEL		 27
! #define VIM_VERSION_PATCHLEVEL_STR	"27"
  
  /*
   * VIM_VERSION_NODOT is used for the runtime directory name.
***************
*** 30,35 ****
   */
  #define VIM_VERSION_NODOT	"vim54"
  #define VIM_VERSION_SHORT	"5.4"
! #define VIM_VERSION_MEDIUM	"5.4.26"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.26 (1999 Aug 13)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.26 (1999 Aug 13, compiled "
--- 30,35 ----
   */
  #define VIM_VERSION_NODOT	"vim54"
  #define VIM_VERSION_SHORT	"5.4"
! #define VIM_VERSION_MEDIUM	"5.4.27"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.27 (1999 Aug 13)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.27 (1999 Aug 13, compiled "

--
hundred-and-one symptoms of being an internet addict:
84. Books in your bookcase bear the names Bongo, WinSock and Inside OLE

--/-/---- Bram Moolenaar ---- [email-masked] ---- [email-masked] ---\-\--
  \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /