diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index fde60648e0..df2644f4e2 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -290,6 +290,7 @@ KEY VALUE ~ *MMDialogsTrackPwd* open/save dialogs track the Vim pwd [bool] *MMDisableLaunchAnimation* disable launch animation when opening a new MacVim window [bool] +*MMDisableTablineAnimation* disable animation in GUI tabs [bool] *MMFontPreserveLineSpacing* use the line-spacing as specified by font [bool] *MMLoginShell* use login shell for launching Vim [bool] *MMLoginShellArgument* login shell parameter [string] diff --git a/runtime/doc/tags b/runtime/doc/tags index b1b23149db..d8b5f59472 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -5648,6 +5648,7 @@ MMCmdLineAlignBottom gui_mac.txt /*MMCmdLineAlignBottom* MMDefaultTablineColors gui_mac.txt /*MMDefaultTablineColors* MMDialogsTrackPwd gui_mac.txt /*MMDialogsTrackPwd* MMDisableLaunchAnimation gui_mac.txt /*MMDisableLaunchAnimation* +MMDisableTablineAnimation gui_mac.txt /*MMDisableTablineAnimation* MMFontPreserveLineSpacing gui_mac.txt /*MMFontPreserveLineSpacing* MMFullScreenFadeTime gui_mac.txt /*MMFullScreenFadeTime* MMLoginShell gui_mac.txt /*MMLoginShell* diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 78df273f4d..116ee74c27 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -196,6 +196,7 @@ + (void)registerDefaults MMUntitledWindowKey, [NSNumber numberWithBool:NO], MMNoWindowShadowKey, [NSNumber numberWithBool:NO], MMDisableLaunchAnimationKey, + [NSNumber numberWithBool:NO], MMDisableTablineAnimationKey, [NSNumber numberWithInt:0], MMAppearanceModeSelectionKey, [NSNumber numberWithBool:NO], MMNoTitleBarWindowKey, [NSNumber numberWithBool:NO], MMTitlebarAppearsTransparentKey, diff --git a/src/MacVim/MMTabline/MMTabline.h b/src/MacVim/MMTabline/MMTabline.h index 347cc86c78..eb59034990 100644 --- a/src/MacVim/MMTabline/MMTabline.h +++ b/src/MacVim/MMTabline/MMTabline.h @@ -16,6 +16,7 @@ @property (nonatomic) NSInteger minimumTabWidth; @property (nonatomic) BOOL showsAddTabButton; @property (nonatomic) BOOL showsTabScrollButtons; +@property (nonatomic) BOOL useAnimation; @property (nonatomic, readonly) NSInteger numberOfTabs; @property (nonatomic, retain, readonly) MMHoverButton *addTabButton; @property (nonatomic, retain) NSColor *tablineBgColor; diff --git a/src/MacVim/MMTabline/MMTabline.m b/src/MacVim/MMTabline/MMTabline.m index ef45c58384..eb37b9f072 100644 --- a/src/MacVim/MMTabline/MMTabline.m +++ b/src/MacVim/MMTabline/MMTabline.m @@ -64,6 +64,7 @@ - (instancetype)initWithFrame:(NSRect)frameRect _tabs = [NSMutableArray new]; _showsAddTabButton = YES; // get from NSUserDefaults _showsTabScrollButtons = YES; // get from NSUserDefaults + _useAnimation = YES; // get from NSUserDefaults _selectedTabIndex = -1; @@ -624,6 +625,9 @@ - (void)fixupTabZOrder - (void)fixupLayoutWithAnimation:(BOOL)shouldAnimate delayResize:(BOOL)delayResize { + if (!self.useAnimation) + shouldAnimate = NO; + if (_tabs.count == 0) { NSRect frame = _tabsContainer.frame; frame.size.width = 0; @@ -859,10 +863,14 @@ - (void)scrollTabToVisibleAtIndex:(NSInteger)index // Left side of the selected tab is clipped. clipBounds.origin.x = tabFrame.origin.x; } - [NSAnimationContext beginGrouping]; - [NSAnimationContext.currentContext setDuration:elapsedTime < 0.2 ? 0.05 : 0.2]; - [_scrollView.contentView.animator setBoundsOrigin:clipBounds.origin]; - [NSAnimationContext endGrouping]; + if (_useAnimation) { + [NSAnimationContext beginGrouping]; + [NSAnimationContext.currentContext setDuration:elapsedTime < 0.2 ? 0.05 : 0.2]; + [_scrollView.contentView.animator setBoundsOrigin:clipBounds.origin]; + [NSAnimationContext endGrouping]; + } else { + [_scrollView.contentView setBoundsOrigin:clipBounds.origin]; + } } } diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index dc1db6060a..b696ac32ee 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -115,6 +115,7 @@ - (MMVimView *)initWithFrame:(NSRect)frame tabline.hidden = YES; tabline.showsAddTabButton = [ud boolForKey:MMShowAddTabButtonKey]; tabline.showsTabScrollButtons = [ud boolForKey:MMShowTabScrollButtonsKey]; + tabline.useAnimation = ![ud boolForKey:MMDisableTablineAnimationKey]; tabline.optimumTabWidth = [ud integerForKey:MMTabOptimumWidthKey]; tabline.minimumTabWidth = [ud integerForKey:MMTabMinWidthKey]; tabline.addTabButton.target = self; diff --git a/src/MacVim/Miscellaneous.h b/src/MacVim/Miscellaneous.h index 3b864602a8..0d297dd094 100644 --- a/src/MacVim/Miscellaneous.h +++ b/src/MacVim/Miscellaneous.h @@ -41,6 +41,7 @@ extern NSString *MMTitlebarAppearsTransparentKey; extern NSString *MMTitlebarShowsDocumentIconKey; extern NSString *MMNoWindowShadowKey; extern NSString *MMDisableLaunchAnimationKey; +extern NSString *MMDisableTablineAnimationKey; extern NSString *MMLoginShellKey; extern NSString *MMUntitledWindowKey; extern NSString *MMZoomBothKey; diff --git a/src/MacVim/Miscellaneous.m b/src/MacVim/Miscellaneous.m index 84b1bbec44..0b1e0523e2 100644 --- a/src/MacVim/Miscellaneous.m +++ b/src/MacVim/Miscellaneous.m @@ -37,6 +37,7 @@ NSString *MMTitlebarShowsDocumentIconKey = @"MMTitlebarShowsDocumentIcon"; NSString *MMNoWindowShadowKey = @"MMNoWindowShadow"; NSString *MMDisableLaunchAnimationKey = @"MMDisableLaunchAnimation"; +NSString *MMDisableTablineAnimationKey = @"MMDisableTablineAnimation"; NSString *MMLoginShellKey = @"MMLoginShell"; NSString *MMUntitledWindowKey = @"MMUntitledWindow"; NSString *MMZoomBothKey = @"MMZoomBoth";