File tree 5 files changed +34
-2
lines changed 5 files changed +34
-2
lines changed Original file line number Diff line number Diff line change 33
33
- (NSInteger )addTabAtIndex : (NSInteger )index ;
34
34
35
35
- (void )closeTab : (MMTab *)tab force : (BOOL )force layoutImmediately : (BOOL )layoutImmediately ;
36
+ - (void )closeAllTabs ;
36
37
37
38
// / Batch update all the tabs using tab tags as unique IDs. Tab line will handle
38
39
// / creating / removing tabs as necessary, and moving tabs to their new
Original file line number Diff line number Diff line change @@ -315,6 +315,18 @@ - (void)closeTab:(MMTab *)tab force:(BOOL)force layoutImmediately:(BOOL)layoutIm
315
315
}
316
316
}
317
317
318
+ - (void )closeAllTabs
319
+ {
320
+ _selectedTabIndex = -1 ;
321
+ _draggedTab = nil ;
322
+ _initialDraggedTabIndex = _finalDraggedTabIndex = NSNotFound ;
323
+ for (MMTab *tab in _tabs) {
324
+ [tab removeFromSuperview ];
325
+ }
326
+ [_tabs removeAllObjects ];
327
+ [self fixupLayoutWithAnimation: NO ];
328
+ }
329
+
318
330
- (void )updateTabsByTags : (NSInteger *)tags len : (NSUInteger )len delayTabResize : (BOOL )delayTabResize
319
331
{
320
332
BOOL needUpdate = NO ;
@@ -564,7 +576,13 @@ - (void)fixupTabZOrder
564
576
565
577
- (void )fixupLayoutWithAnimation : (BOOL )shouldAnimate delayResize : (BOOL )delayResize
566
578
{
567
- if (_tabs.count == 0 ) return ;
579
+ if (_tabs.count == 0 ) {
580
+ NSRect frame = _tabsContainer.frame ;
581
+ frame.size .width = 0 ;
582
+ _tabsContainer.frame = frame;
583
+ [self updateTabScrollButtonsEnabledState ];
584
+ return ;
585
+ }
568
586
569
587
if (delayResize) {
570
588
// The pending delayed resize is trigged by mouse exit, but if we are
Original file line number Diff line number Diff line change 44
44
45
45
- (MMTabline *)tabline ;
46
46
- (IBAction )addNewTab : (id )sender ;
47
+ - (void )showTabline : (BOOL )on ;
47
48
- (void )updateTabsWithData : (NSData *)data ;
48
49
- (void )refreshTabProperties ;
49
50
Original file line number Diff line number Diff line change @@ -251,9 +251,21 @@ - (void)setDesiredRows:(int)r columns:(int)c
251
251
252
252
- (IBAction )addNewTab : (id )sender
253
253
{
254
+ // Callback from the "Create a new tab button". We override this so we can
255
+ // send a message to Vim first and let it handle it before replying back.
254
256
[vimController sendMessage: AddNewTabMsgID data: nil ];
255
257
}
256
258
259
+ - (void )showTabline : (BOOL )on
260
+ {
261
+ [tabline setHidden: !on];
262
+ if (!on) {
263
+ // When the tab is not shown we don't get tab updates from Vim. We just
264
+ // close all of them as otherwise we will be holding onto stale states.
265
+ [tabline closeAllTabs ];
266
+ }
267
+ }
268
+
257
269
// / Callback from Vim to update the tabline with new tab data
258
270
- (void )updateTabsWithData : (NSData *)data
259
271
{
Original file line number Diff line number Diff line change @@ -868,7 +868,7 @@ - (void)processInputQueueDidFinish
868
868
869
869
- (void )showTabline : (BOOL )on
870
870
{
871
- [[ vimView tabline ] setHidden: ! on];
871
+ [vimView showTabline: on];
872
872
[self updateTablineSeparator ];
873
873
shouldMaximizeWindow = YES ;
874
874
}
You can’t perform that action at this time.
0 commit comments