Skip to content

Commit eb6668f

Browse files
jpetrieJosh Petrie
authored andcommitted
Use a non-null identifier when creating new tabs.
1 parent c7fad5c commit eb6668f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/MacVim/MMVimView.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,10 @@ - (NSTabViewItem *)addNewTabViewItem
396396
// which tab should be selected at all times. However, the AppKit will
397397
// automatically select the first tab added to a tab view.
398398

399-
NSTabViewItem *tvi = [[NSTabViewItem alloc] initWithIdentifier:nil];
399+
// The documentation claims initWithIdentifier can be given a nil identifier, but the API itself
400+
// is decorated such that doing so produces a warning, so the tab count is used as identifier.
401+
NSInteger identifier = [[self tabView] numberOfTabViewItems];
402+
NSTabViewItem *tvi = [[NSTabViewItem alloc] initWithIdentifier:[NSNumber numberWithInt:identifier]];
400403

401404
// NOTE: If this is the first tab it will be automatically selected.
402405
vimTaskSelectedTab = YES;

0 commit comments

Comments
 (0)