From 1a91b2a5c9100a2a024d6dc7bd7ae87551ea0660 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sat, 18 Oct 2008 13:23:24 +0200 Subject: [PATCH] Fix computation of zoomed window frame When computing the zoomed window frame ensure that it is constrained to hold an even number of rows and columns. This fixes a problem where the window would not "un-zoom" after being zoomed. --- src/MacVim/MMWindowController.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index f4e5a20f28..a70b8dd32d 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -762,6 +762,19 @@ BOOL zoomBoth = [[NSUserDefaults standardUserDefaults] boolForKey:MMZoomBothKey]; + // The "default frame" represents the maximal size of a zoomed window. + // Constrain this frame so that the content fits an even number of rows and + // columns. + NSRect contentRect = [decoratedWindow contentRectForFrameRect:frame]; + NSSize constrainedSize = [vimView constrainRows:NULL + columns:NULL + toSize:contentRect.size]; + + contentRect.origin.y += contentRect.size.height - constrainedSize.height; + contentRect.size = constrainedSize; + + frame = [decoratedWindow frameRectForContentRect:contentRect]; + if (!((zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick))) { // Zoom in horizontal direction only. NSRect currentFrame = [win frame];