Merge pull request #357 from macvim-dev/fix/tabwidth

Honor defaults settings of Tab width on Yosemite or later
This commit is contained in:
Kazuki Sakamoto
2016-09-20 16:35:52 -07:00
committed by GitHub
2 changed files with 30 additions and 7 deletions
+20 -4
View File
@@ -181,12 +181,28 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
CFPreferencesSetAppValue(CFSTR("NSRepeatCountBinding"),
CFSTR(""),
kCFPreferencesCurrentApplication);
int tabMinWidthKey;
int tabMaxWidthKey;
int tabOptimumWidthKey;
if (shouldUseYosemiteTabBarStyle()) {
tabMinWidthKey = 120;
tabMaxWidthKey = 0;
tabOptimumWidthKey = 0;
} else {
tabMinWidthKey = 64;
tabMaxWidthKey = 6*64;
tabOptimumWidthKey = 132;
}
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], MMNoWindowKey,
[NSNumber numberWithInt:64], MMTabMinWidthKey,
[NSNumber numberWithInt:6*64], MMTabMaxWidthKey,
[NSNumber numberWithInt:132], MMTabOptimumWidthKey,
[NSNumber numberWithInt:tabMinWidthKey],
MMTabMinWidthKey,
[NSNumber numberWithInt:tabMaxWidthKey],
MMTabMaxWidthKey,
[NSNumber numberWithInt:tabOptimumWidthKey],
MMTabOptimumWidthKey,
[NSNumber numberWithBool:YES], MMShowAddTabButtonKey,
[NSNumber numberWithInt:2], MMTextInsetLeftKey,
[NSNumber numberWithInt:1], MMTextInsetRightKey,
+10 -3
View File
@@ -127,10 +127,17 @@ enum {
if (shouldUseYosemiteTabBarStyle()) {
CGFloat screenWidth = [[NSScreen mainScreen] frame].size.width;
int tabMaxWidth = [ud integerForKey:MMTabMaxWidthKey];
if (tabMaxWidth == 0)
tabMaxWidth = screenWidth;
int tabOptimumWidth = [ud integerForKey:MMTabOptimumWidthKey];
if (tabOptimumWidth == 0)
tabOptimumWidth = screenWidth;
[tabBarControl setStyleNamed:@"Yosemite"];
[tabBarControl setCellMinWidth:120];
[tabBarControl setCellMaxWidth:screenWidth];
[tabBarControl setCellOptimumWidth:screenWidth];
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
[tabBarControl setCellMaxWidth:tabMaxWidth];
[tabBarControl setCellOptimumWidth:tabOptimumWidth];
} else {
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
[tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]];