@@ -254,7 +254,6 @@ - (IBAction)addNewTab:(id)sender
254254
255255- (void )updateTabsWithData : (NSData *)data
256256{
257- NSLog (@" %s " , __FUNCTION__);
258257 const void *p = [data bytes ];
259258 const void *end = p + [data length ];
260259 int tabIdx = 0 ;
@@ -321,17 +320,12 @@ - (void)updateTabsWithData:(NSData *)data
321320 }
322321 }
323322
324- // Remove unused tabs from the tabline. Note that when a tab is closed
325- // the tabline will automatically select another tab, but we want Vim to
326- // take care of which tab to select so set the vimTaskSelectedTab flag to
327- // prevent the tab selection message to be passed on to the VimTask.
328- vimTaskSelectedTab = YES ;
323+ // Remove unused tabs from the tabline.
329324 int i, count = tabline.numberOfTabs ;
330325 for (i = count-1 ; i >= tabIdx; --i) {
331326 MMTab *tv = [tabline tabAtIndex: i];
332327 [tabline closeTab: tv force: YES layoutImmediately: YES ];
333328 }
334- vimTaskSelectedTab = NO ;
335329
336330 [self selectTabWithIndex: curtabIdx];
337331 // It would be better if we could scroll to the selected tab only if it
@@ -349,35 +343,24 @@ - (void)updateTabsWithData:(NSData *)data
349343
350344- (void )selectTabWithIndex : (int )idx
351345{
352- NSLog (@" %s : index= %d " ,__FUNCTION__, idx);
353346 if (idx < 0 || idx >= tabline.numberOfTabs ) {
354347 ASLogWarn (@" No tab with index %d exists." , idx);
355348 return ;
356349 }
357-
358350 // Do not try to select a tab if already selected.
359351 if (idx != tabline.selectedTabIndex ) {
360- NSLog (@" selecting tab %d " , idx);
361- vimTaskSelectedTab = YES ;
362352 [tabline selectTabAtIndex: idx];
363- vimTaskSelectedTab = NO ;
364-
365353 // We might need to change the scrollbars that are visible.
366354 self.pendingPlaceScrollbars = YES ;
367355 }
368- else {
369- NSLog (@" NOT selecting tab %d ; already selected" , idx);
370- }
371356}
372357
373358- (MMTab *)addNewTab
374359{
375360 // NOTE! A newly created tab is not by selected by default; Vim decides
376361 // which tab should be selected at all times. However, the AppKit will
377362 // automatically select the first tab added to a tab view.
378- vimTaskSelectedTab = YES ;
379363 NSUInteger index = [tabline addTabAtEnd ];
380- vimTaskSelectedTab = NO ;
381364 return [tabline tabAtIndex: index];
382365}
383366
@@ -532,23 +515,18 @@ - (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore
532515
533516- (BOOL )tabline : (MMTabline *)tabline shouldSelectTabAtIndex : (NSUInteger )index
534517{
535- NSLog (@" %s : index= %ld , vimTaskSelectedTab= %d " , __FUNCTION__, index, vimTaskSelectedTab);
536- if (!vimTaskSelectedTab) {
537- // Propagate the selection message to Vim.
538- if (NSNotFound != index) {
539- int i = (int )index; // HACK! Never more than MAXINT tabs?!
540- NSData *data = [NSData dataWithBytes: &i length: sizeof (int )];
541- [vimController sendMessage: SelectTabMsgID data: data];
542- }
518+ // Propagate the selection message to Vim.
519+ if (NSNotFound != index) {
520+ int i = (int )index; // HACK! Never more than MAXINT tabs?!
521+ NSData *data = [NSData dataWithBytes: &i length: sizeof (int )];
522+ [vimController sendMessage: SelectTabMsgID data: data];
543523 }
544- // Unless Vim selected the tab, return NO, and let Vim decide if the tab
545- // should get selected or not.
546- return vimTaskSelectedTab;
524+ // Let Vim decide whether to select the tab or not.
525+ return NO ;
547526}
548527
549528- (BOOL )tabline : (MMTabline *)tabline shouldCloseTabAtIndex : (NSUInteger )index
550529{
551- NSLog (@" %s : index= %ld " , __FUNCTION__, index);
552530 if (index >= 0 && index < tabline.numberOfTabs - 1 ) {
553531 tabToClose = [tabline tabAtIndex: index];
554532 }
@@ -563,7 +541,6 @@ - (BOOL)tabline:(MMTabline *)tabline shouldCloseTabAtIndex:(NSUInteger)index
563541
564542- (void )tabline : (MMTabline *)tabline didDragTab : (MMTab *)tab toIndex : (NSUInteger )index
565543{
566- NSLog (@" %s " , __FUNCTION__);
567544 NSMutableData *data = [NSMutableData data ];
568545 [data appendBytes: &index length: sizeof (int )];
569546 [vimController sendMessage: DraggedTabMsgID data: data];
0 commit comments