@@ -174,7 +174,7 @@ - (id)initWithVimController:(MMVimController *)controller
174
174
175
175
[win setDelegate: self ];
176
176
[win setInitialFirstResponder: [vimView textView ]];
177
-
177
+
178
178
if ([win styleMask ] & NSWindowStyleMaskTexturedBackground ) {
179
179
// On Leopard, we want to have a textured window to have nice
180
180
// looking tabs. But the textured window look implies rounded
@@ -381,6 +381,7 @@ - (void)selectTabWithIndex:(int)idx
381
381
}
382
382
383
383
- (void )setTextDimensionsWithRows : (int )rows columns : (int )cols isLive : (BOOL )live
384
+ keepGUISize : (BOOL )keepGUISize
384
385
keepOnScreen : (BOOL )onScreen
385
386
{
386
387
ASLogDebug (@" setTextDimensionsWithRows:%d columns:%d isLive:%d "
@@ -399,7 +400,7 @@ - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
399
400
400
401
[vimView setDesiredRows: rows columns: cols];
401
402
402
- if (setupDone && !live) {
403
+ if (setupDone && !live && !keepGUISize ) {
403
404
shouldResizeVimView = YES ;
404
405
keepOnScreen = onScreen;
405
406
}
@@ -428,6 +429,15 @@ - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
428
429
}
429
430
}
430
431
432
+ - (void )resizeView
433
+ {
434
+ if (setupDone)
435
+ {
436
+ shouldResizeVimView = YES ;
437
+ shouldKeepGUISize = YES ;
438
+ }
439
+ }
440
+
431
441
- (void )zoomWithRows : (int )rows columns : (int )cols state : (int )state
432
442
{
433
443
[self setTextDimensionsWithRows: rows
@@ -503,19 +513,13 @@ - (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type
503
513
- (BOOL )destroyScrollbarWithIdentifier : (int32_t )ident
504
514
{
505
515
BOOL scrollbarHidden = [vimView destroyScrollbarWithIdentifier: ident];
506
- shouldResizeVimView = shouldResizeVimView || scrollbarHidden;
507
- shouldMaximizeWindow = shouldMaximizeWindow || scrollbarHidden;
508
-
509
516
return scrollbarHidden;
510
517
}
511
518
512
519
- (BOOL )showScrollbarWithIdentifier : (int32_t )ident state : (BOOL )visible
513
520
{
514
521
BOOL scrollbarToggled = [vimView showScrollbarWithIdentifier: ident
515
522
state: visible];
516
- shouldResizeVimView = shouldResizeVimView || scrollbarToggled;
517
- shouldMaximizeWindow = shouldMaximizeWindow || scrollbarToggled;
518
-
519
523
return scrollbarToggled;
520
524
}
521
525
@@ -600,7 +604,18 @@ - (void)processInputQueueDidFinish
600
604
fullScreenWindow ? [fullScreenWindow frame ].size :
601
605
fullScreenEnabled ? desiredWindowSize :
602
606
[self constrainContentSizeToScreenSize: [vimView desiredSize ]]];
603
- [vimView setFrameSize: contentSize];
607
+
608
+ // Setting 'guioptions+=k' will make shouldKeepGUISize true, which
609
+ // means avoid resizing the window. Instead, resize the view instead
610
+ // to keep the GUI window's size consistent.
611
+ bool avoidWindowResize = shouldKeepGUISize && !fullScreenEnabled;
612
+
613
+ if (!avoidWindowResize) {
614
+ [vimView setFrameSize: contentSize];
615
+ }
616
+ else {
617
+ [vimView setFrameSizeKeepGUISize: originalSize];
618
+ }
604
619
605
620
if (fullScreenWindow) {
606
621
// NOTE! Don't mark the full-screen content view as needing an
@@ -613,12 +628,15 @@ - (void)processInputQueueDidFinish
613
628
[fullScreenWindow centerView ];
614
629
}
615
630
} else {
616
- [self resizeWindowToFitContentSize: contentSize
617
- keepOnScreen: keepOnScreen];
631
+ if (!avoidWindowResize) {
632
+ [self resizeWindowToFitContentSize: contentSize
633
+ keepOnScreen: keepOnScreen];
634
+ }
618
635
}
619
636
}
620
637
621
638
keepOnScreen = NO ;
639
+ shouldKeepGUISize = NO ;
622
640
}
623
641
}
624
642
@@ -657,15 +675,13 @@ - (void)adjustLinespace:(int)linespace
657
675
{
658
676
if (vimView && [vimView textView ]) {
659
677
[[vimView textView ] setLinespace: (float )linespace];
660
- shouldMaximizeWindow = shouldResizeVimView = YES ;
661
678
}
662
679
}
663
680
664
681
- (void )adjustColumnspace : (int )columnspace
665
682
{
666
683
if (vimView && [vimView textView ]) {
667
684
[[vimView textView ] setColumnspace: (float )columnspace];
668
- shouldMaximizeWindow = shouldResizeVimView = YES ;
669
685
}
670
686
}
671
687
@@ -1177,7 +1193,7 @@ - (void)window:(NSWindow *)window
1177
1193
[[window animator ] setAlphaValue: 0 ];
1178
1194
} completionHandler: ^{
1179
1195
[self maximizeWindow: fullScreenOptions];
1180
-
1196
+
1181
1197
// Fade in
1182
1198
[NSAnimationContext runAnimationGroup: ^(NSAnimationContext *context) {
1183
1199
[context setDuration: 0.5 *duration];
@@ -1196,7 +1212,7 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification
1196
1212
1197
1213
// The separator should never be visible in fullscreen or split-screen.
1198
1214
[decoratedWindow hideTablineSeparator: YES ];
1199
-
1215
+
1200
1216
// ASSUMPTION: fullScreenEnabled always reflects the state of Vim's 'fu'.
1201
1217
if (!fullScreenEnabled) {
1202
1218
ASLogDebug (@" Full-screen out of sync, tell Vim to set 'fu'" );
@@ -1298,7 +1314,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification
1298
1314
// full-screen by moving the window out from Split View.
1299
1315
[vimController sendMessage: BackingPropertiesChangedMsgID data: nil ];
1300
1316
}
1301
-
1317
+
1302
1318
[self updateTablineSeparator ];
1303
1319
}
1304
1320
@@ -1519,7 +1535,6 @@ - (void)hideTablineSeparator:(BOOL)hide
1519
1535
// The tabline separator was toggled so the content view must change
1520
1536
// size.
1521
1537
[self updateResizeConstraints ];
1522
- shouldResizeVimView = YES ;
1523
1538
}
1524
1539
}
1525
1540
0 commit comments