@@ -398,6 +398,7 @@ - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
398398 // user drags to resize the window.
399399
400400 [vimView setDesiredRows: rows columns: cols];
401+ vimView.pendingLiveResize = NO ;
401402
402403 if (setupDone && !live && !keepGUISize) {
403404 shouldResizeVimView = YES ;
@@ -599,39 +600,27 @@ - (void)processInputQueueDidFinish
599600 if (!didMaximize) {
600601 NSSize originalSize = [vimView frame ].size ;
601602 int rows = 0 , cols = 0 ;
602- NSSize contentSize = [vimView constrainRows: &rows columns: &cols
603- toSize:
604- fullScreenWindow ? [fullScreenWindow frame ].size :
605- fullScreenEnabled ? desiredWindowSize :
606- [self constrainContentSizeToScreenSize: [vimView desiredSize ]]];
607603
608604 // Setting 'guioptions+=k' will make shouldKeepGUISize true, which
609605 // means avoid resizing the window. Instead, resize the view instead
610606 // to keep the GUI window's size consistent.
611- bool avoidWindowResize = shouldKeepGUISize && ! fullScreenEnabled;
607+ bool avoidWindowResize = shouldKeepGUISize || fullScreenEnabled;
612608
613609 if (!avoidWindowResize) {
610+ NSSize contentSize = [vimView constrainRows: &rows columns: &cols
611+ toSize:
612+ fullScreenWindow ? [fullScreenWindow frame ].size :
613+ fullScreenEnabled ? desiredWindowSize :
614+ [self constrainContentSizeToScreenSize: [vimView desiredSize ]]];
615+
614616 [vimView setFrameSize: contentSize];
617+
618+ [self resizeWindowToFitContentSize: contentSize
619+ keepOnScreen: keepOnScreen];
615620 }
616621 else {
617- [vimView setFrameSizeKeepGUISize: originalSize];
618- }
619-
620- if (fullScreenWindow) {
621- // NOTE! Don't mark the full-screen content view as needing an
622- // update unless absolutely necessary since when it is updated
623- // the entire screen is cleared. This may cause some parts of
624- // the Vim view to be cleared but not redrawn since Vim does
625- // not realize that we've erased part of the view.
626- if (!NSEqualSizes (originalSize, contentSize)) {
627- [[fullScreenWindow contentView ] setNeedsDisplay: YES ];
628- [fullScreenWindow centerView ];
629- }
630- } else {
631- if (!avoidWindowResize) {
632- [self resizeWindowToFitContentSize: contentSize
633- keepOnScreen: keepOnScreen];
634- }
622+ NSSize frameSize = fullScreenWindow ? [fullScreenWindow frame ].size : (fullScreenEnabled ? desiredWindowSize : originalSize);
623+ [vimView setFrameSizeKeepGUISize: frameSize];
635624 }
636625 }
637626
@@ -724,6 +713,13 @@ - (void)liveResizeDidEnd
724713 [lastSetTitle release ];
725714 lastSetTitle = nil ;
726715 }
716+
717+ // If we are in the middle of rapid resize (e.g. double-clicking on the border/corner
718+ // of window), we would fire off a lot of LiveResizeMsgID messages where some will be
719+ // intentionally omitted to avoid swamping IPC. If that happens this will perform a
720+ // final clean up that makes sure the Vim view is sized correctly within the window.
721+ // See frameSizeMayHaveChanged: for where the omission/rate limiting happens.
722+ [self resizeView ];
727723}
728724
729725- (void )setBlurRadius : (int )radius
@@ -1059,14 +1055,10 @@ - (void)windowDidResize:(id)sender
10591055 // may resize automatically) we simply set the view to fill the entire
10601056 // window. The vim view takes care of notifying Vim if the number of
10611057 // (rows,columns) changed.
1062- if (shouldKeepGUISize) {
1063- // This happens when code manually call setFrame: when we are performing
1064- // an operation that wants to preserve GUI size (e.g. in updateToolbar:).
1065- // Respect the wish, and pass that along.
1066- [vimView setFrameSizeKeepGUISize: [self contentSize ]];
1067- } else {
1068- [vimView setFrameSize: [self contentSize ]];
1069- }
1058+ // Calling setFrameSizeKeepGUISize: instead of setFrameSize: prevents a
1059+ // degenerate case where frameSizeMayHaveChanged: ends up resizing the window
1060+ // *again* causing windowDidResize: to be called.
1061+ [vimView setFrameSizeKeepGUISize: [self contentSize ]];
10701062}
10711063
10721064- (void )windowDidChangeBackingProperties : (NSNotification *)notification
0 commit comments