Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Constrain window before autosaving dimensions

This fixes a bug where the view would not be maximized vertically when
entering full screen on startup.  (Debugging assist by David Whetstone.)
  • Loading branch information...
commit 8b4669ff38db551849224db1f9c77cdd014d504e 1 parent 4ea64bd
@b4winckler authored
Showing with 14 additions and 13 deletions.
  1. +14 −13 src/MacVim/MMWindowController.m
View
27 src/MacVim/MMWindowController.m
@@ -326,18 +326,6 @@ - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
shouldResizeVimView = YES;
keepOnScreen = onScreen;
}
-
- if (windowAutosaveKey) {
- // Autosave rows and columns (only done for window which also autosaves
- // window position).
- id tv = [vimView textView];
- int rows = [tv maxRows];
- int cols = [tv maxColumns];
- NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
- [ud setInteger:rows forKey:MMAutosaveRowsKey];
- [ud setInteger:cols forKey:MMAutosaveColumnsKey];
- [ud synchronize];
- }
}
- (void)zoomWithRows:(int)rows columns:(int)cols state:(int)state
@@ -484,7 +472,8 @@ - (void)processInputQueueDidFinish
NSSize originalSize = [vimView frame].size;
NSSize contentSize = [vimView desiredSize];
contentSize = [self constrainContentSizeToScreenSize:contentSize];
- contentSize = [vimView constrainRows:NULL columns:NULL
+ int rows = 0, cols = 0;
+ contentSize = [vimView constrainRows:&rows columns:&cols
toSize:contentSize];
[vimView setFrameSize:contentSize];
@@ -501,6 +490,18 @@ - (void)processInputQueueDidFinish
} else {
[self resizeWindowToFitContentSize:contentSize
keepOnScreen:keepOnScreen];
+
+ if (windowAutosaveKey && rows > 0 && cols > 0) {
+ // Autosave rows and columns now that they should have been
+ // constrained to fit on screen. We only do this for the
+ // window which also autosaves window position and we avoid
+ // autosaving when in fullscreen since the rows usually won't
+ // fit when in windowed mode.
+ NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+ [ud setInteger:rows forKey:MMAutosaveRowsKey];
+ [ud setInteger:cols forKey:MMAutosaveColumnsKey];
+ [ud synchronize];
+ }
}
keepOnScreen = NO;
Please sign in to comment.
Something went wrong with that request. Please try again.