From eb6668f805a60809a5a0060bb74e019e81a1bac4 Mon Sep 17 00:00:00 2001 From: Josh Petrie Date: Mon, 12 Oct 2015 17:57:59 -0700 Subject: [PATCH] Use a non-null identifier when creating new tabs. --- src/MacVim/MMVimView.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index 98ff98d803..9f9c1e0909 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -396,7 +396,10 @@ enum { // which tab should be selected at all times. However, the AppKit will // automatically select the first tab added to a tab view. - NSTabViewItem *tvi = [[NSTabViewItem alloc] initWithIdentifier:nil]; + // The documentation claims initWithIdentifier can be given a nil identifier, but the API itself + // is decorated such that doing so produces a warning, so the tab count is used as identifier. + NSInteger identifier = [[self tabView] numberOfTabViewItems]; + NSTabViewItem *tvi = [[NSTabViewItem alloc] initWithIdentifier:[NSNumber numberWithInt:identifier]]; // NOTE: If this is the first tab it will be automatically selected. vimTaskSelectedTab = YES;