@@ -254,7 +254,6 @@ - (IBAction)addNewTab:(id)sender
254
254
255
255
- (void )updateTabsWithData : (NSData *)data
256
256
{
257
- NSLog (@" %s " , __FUNCTION__);
258
257
const void *p = [data bytes ];
259
258
const void *end = p + [data length ];
260
259
int tabIdx = 0 ;
@@ -321,17 +320,12 @@ - (void)updateTabsWithData:(NSData *)data
321
320
}
322
321
}
323
322
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.
329
324
int i, count = tabline.numberOfTabs ;
330
325
for (i = count-1 ; i >= tabIdx; --i) {
331
326
MMTab *tv = [tabline tabAtIndex: i];
332
327
[tabline closeTab: tv force: YES layoutImmediately: YES ];
333
328
}
334
- vimTaskSelectedTab = NO ;
335
329
336
330
[self selectTabWithIndex: curtabIdx];
337
331
// It would be better if we could scroll to the selected tab only if it
@@ -349,35 +343,24 @@ - (void)updateTabsWithData:(NSData *)data
349
343
350
344
- (void )selectTabWithIndex : (int )idx
351
345
{
352
- NSLog (@" %s : index= %d " ,__FUNCTION__, idx);
353
346
if (idx < 0 || idx >= tabline.numberOfTabs ) {
354
347
ASLogWarn (@" No tab with index %d exists." , idx);
355
348
return ;
356
349
}
357
-
358
350
// Do not try to select a tab if already selected.
359
351
if (idx != tabline.selectedTabIndex ) {
360
- NSLog (@" selecting tab %d " , idx);
361
- vimTaskSelectedTab = YES ;
362
352
[tabline selectTabAtIndex: idx];
363
- vimTaskSelectedTab = NO ;
364
-
365
353
// We might need to change the scrollbars that are visible.
366
354
self.pendingPlaceScrollbars = YES ;
367
355
}
368
- else {
369
- NSLog (@" NOT selecting tab %d ; already selected" , idx);
370
- }
371
356
}
372
357
373
358
- (MMTab *)addNewTab
374
359
{
375
360
// NOTE! A newly created tab is not by selected by default; Vim decides
376
361
// which tab should be selected at all times. However, the AppKit will
377
362
// automatically select the first tab added to a tab view.
378
- vimTaskSelectedTab = YES ;
379
363
NSUInteger index = [tabline addTabAtEnd ];
380
- vimTaskSelectedTab = NO ;
381
364
return [tabline tabAtIndex: index];
382
365
}
383
366
@@ -532,23 +515,18 @@ - (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore
532
515
533
516
- (BOOL )tabline : (MMTabline *)tabline shouldSelectTabAtIndex : (NSUInteger )index
534
517
{
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];
543
523
}
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 ;
547
526
}
548
527
549
528
- (BOOL )tabline : (MMTabline *)tabline shouldCloseTabAtIndex : (NSUInteger )index
550
529
{
551
- NSLog (@" %s : index= %ld " , __FUNCTION__, index);
552
530
if (index >= 0 && index < tabline.numberOfTabs - 1 ) {
553
531
tabToClose = [tabline tabAtIndex: index];
554
532
}
@@ -563,7 +541,6 @@ - (BOOL)tabline:(MMTabline *)tabline shouldCloseTabAtIndex:(NSUInteger)index
563
541
564
542
- (void )tabline : (MMTabline *)tabline didDragTab : (MMTab *)tab toIndex : (NSUInteger )index
565
543
{
566
- NSLog (@" %s " , __FUNCTION__);
567
544
NSMutableData *data = [NSMutableData data ];
568
545
[data appendBytes: &index length: sizeof (int )];
569
546
[vimController sendMessage: DraggedTabMsgID data: data];
0 commit comments