Skip to content

Commit 0702677

Browse files
authored
Merge pull request #357 from macvim-dev/fix/tabwidth
Honor defaults settings of Tab width on Yosemite or later
2 parents 418cb17 + ff43fd2 commit 0702677

2 files changed

Lines changed: 30 additions & 7 deletions

File tree

src/MacVim/MMAppController.m

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,28 @@ + (void)initialize
181181
CFPreferencesSetAppValue(CFSTR("NSRepeatCountBinding"),
182182
CFSTR(""),
183183
kCFPreferencesCurrentApplication);
184-
184+
185+
int tabMinWidthKey;
186+
int tabMaxWidthKey;
187+
int tabOptimumWidthKey;
188+
if (shouldUseYosemiteTabBarStyle()) {
189+
tabMinWidthKey = 120;
190+
tabMaxWidthKey = 0;
191+
tabOptimumWidthKey = 0;
192+
} else {
193+
tabMinWidthKey = 64;
194+
tabMaxWidthKey = 6*64;
195+
tabOptimumWidthKey = 132;
196+
}
197+
185198
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
186199
[NSNumber numberWithBool:NO], MMNoWindowKey,
187-
[NSNumber numberWithInt:64], MMTabMinWidthKey,
188-
[NSNumber numberWithInt:6*64], MMTabMaxWidthKey,
189-
[NSNumber numberWithInt:132], MMTabOptimumWidthKey,
200+
[NSNumber numberWithInt:tabMinWidthKey],
201+
MMTabMinWidthKey,
202+
[NSNumber numberWithInt:tabMaxWidthKey],
203+
MMTabMaxWidthKey,
204+
[NSNumber numberWithInt:tabOptimumWidthKey],
205+
MMTabOptimumWidthKey,
190206
[NSNumber numberWithBool:YES], MMShowAddTabButtonKey,
191207
[NSNumber numberWithInt:2], MMTextInsetLeftKey,
192208
[NSNumber numberWithInt:1], MMTextInsetRightKey,

src/MacVim/MMVimView.m

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,17 @@ - (MMVimView *)initWithFrame:(NSRect)frame
127127

128128
if (shouldUseYosemiteTabBarStyle()) {
129129
CGFloat screenWidth = [[NSScreen mainScreen] frame].size.width;
130+
int tabMaxWidth = [ud integerForKey:MMTabMaxWidthKey];
131+
if (tabMaxWidth == 0)
132+
tabMaxWidth = screenWidth;
133+
int tabOptimumWidth = [ud integerForKey:MMTabOptimumWidthKey];
134+
if (tabOptimumWidth == 0)
135+
tabOptimumWidth = screenWidth;
136+
130137
[tabBarControl setStyleNamed:@"Yosemite"];
131-
[tabBarControl setCellMinWidth:120];
132-
[tabBarControl setCellMaxWidth:screenWidth];
133-
[tabBarControl setCellOptimumWidth:screenWidth];
138+
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
139+
[tabBarControl setCellMaxWidth:tabMaxWidth];
140+
[tabBarControl setCellOptimumWidth:tabOptimumWidth];
134141
} else {
135142
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
136143
[tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]];

0 commit comments

Comments
 (0)