diff --git a/ThirdParty/PSMTabBarControl/source/PSMYosemiteTabStyle.m b/ThirdParty/PSMTabBarControl/source/PSMYosemiteTabStyle.m index d5879806dc..06bae5806d 100644 --- a/ThirdParty/PSMTabBarControl/source/PSMYosemiteTabStyle.m +++ b/ThirdParty/PSMTabBarControl/source/PSMYosemiteTabStyle.m @@ -9,6 +9,7 @@ #import "PSMYosemiteTabStyle.h" #import "PSMTabBarCell.h" #import "PSMTabBarControl.h" +#import "iTermAdvancedSettingsModel.h" #define kPSMMetalObjectCounterRadius 7.0 #define kPSMMetalCounterMinWidth 20 @@ -296,7 +297,16 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell { if (!truncatingTailParagraphStyle) { truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; + switch ([iTermAdvancedSettingsModel tabLabelTruncationStyle]) { + case kAdvancedSettingsTruncationStyleLeft: + [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingHead]; + break; + case kAdvancedSettingsTruncationStyleMiddle: + [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingMiddle]; + break; + default: + [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; + } [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; } [attrStr addAttribute:NSParagraphStyleAttributeName diff --git a/sources/iTermAdvancedSettingsModel.h b/sources/iTermAdvancedSettingsModel.h index dd853e143a..360440636f 100644 --- a/sources/iTermAdvancedSettingsModel.h +++ b/sources/iTermAdvancedSettingsModel.h @@ -8,8 +8,15 @@ #import +enum { + kAdvancedSettingsTruncationStyleRight = 0, + kAdvancedSettingsTruncationStyleMiddle = 1, + kAdvancedSettingsTruncationStyleLeft = 2 +}; + @interface iTermAdvancedSettingsModel : NSObject ++ (int)tabLabelTruncationStyle; + (BOOL)useUnevenTabs; + (int)minTabWidth; + (int)minCompactTabWidth; diff --git a/sources/iTermAdvancedSettingsModel.m b/sources/iTermAdvancedSettingsModel.m index eb84f47294..43d97f19b9 100644 --- a/sources/iTermAdvancedSettingsModel.m +++ b/sources/iTermAdvancedSettingsModel.m @@ -45,6 +45,7 @@ + (NSString *)name { \ } #pragma mark Tabs +DEFINE_INT(tabLabelTruncationStyle, kAdvancedSettingsTruncationStyleRight, @"Tabs: Tab label truncation style.\n0=Right, 1=Middle, 2=Left."); DEFINE_BOOL(useUnevenTabs, NO, @"Tabs: Uneven tab widths allowed."); DEFINE_INT(minTabWidth, 75, @"Tabs: Minimum tab width when using uneven tab widths."); DEFINE_INT(minCompactTabWidth, 60, @"Tabs: Minimum tab width when using uneven tab widths for compact tabs.");