Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/MacVim/MMVimController.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

static NSString * const MMToolbarMenuName = @"ToolBar";
static NSString * const MMTouchbarMenuName = @"TouchBar";
static NSString * const MMWinBarMenuName = @"WinBar";
static NSString * const MMPopUpMenuPrefix = @"PopUp";
static NSString * const MMUserPopUpMenuPrefix = @"]";

Expand Down Expand Up @@ -1242,6 +1243,11 @@ - (void)addMenuWithDescriptor:(NSArray *)desc atIndex:(int)idx
return;
}

if ([rootName isEqual:MMWinBarMenuName]) {
// WinBar menus are completed handled within Vim windows. No need for GUI to do anything.
return;
}

// This is either a main menu item or a popup menu item.
NSString *title = [desc lastObject];
NSMenuItem *item = [[NSMenuItem alloc] init];
Expand All @@ -1261,7 +1267,10 @@ - (void)addMenuWithDescriptor:(NSArray *)desc atIndex:(int)idx
} else {
// If descriptor has no parent and its not a popup (or toolbar) menu,
// then it must belong to main menu.
if (!parent) parent = mainMenu;
if (!parent) {
parent = mainMenu;
idx += 1; // Main menu already has the application menu as the first item, so everything else must be shifted by one.
}

if ([parent numberOfItems] <= idx) {
[parent addItem:item];
Expand Down Expand Up @@ -1311,6 +1320,11 @@ - (void)addMenuItemWithDescriptor:(NSArray *)desc
#endif
return;
}
if ([rootName isEqual:MMWinBarMenuName]) {
// WinBar menus are completed handled within Vim windows. No need for GUI to do anything.
return;
}

NSMenu *parent = [self parentMenuForDescriptor:desc];
if (!parent) {
ASLogWarn(@"Menu item '%@' has no parent",
Expand Down