Skip to content

Commit 0944187

Browse files
committed
Revert "Fix bad interaction with never opening window + terminate on last window"
This reverts commit f6ba7dd. This change was reverted as part of #1338 as we want to implement a different solution.
1 parent b64e13c commit 0944187

3 files changed

Lines changed: 2 additions & 45 deletions

File tree

src/MacVim/Base.lproj/Preferences.xib

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment version="1090" identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
66
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
77
</dependencies>
88
<objects>
@@ -67,7 +67,6 @@
6767
</column>
6868
</cells>
6969
<connections>
70-
<action selector="openUntitledWindowChanged:" target="-2" id="S8l-uX-tEl"/>
7170
<binding destination="58" name="selectedTag" keyPath="values.MMUntitledWindow" id="171"/>
7271
</connections>
7372
</matrix>
@@ -180,7 +179,6 @@
180179
</menu>
181180
</popUpButtonCell>
182181
<connections>
183-
<action selector="lastWindowClosedChanged:" target="-2" id="IcT-7v-gxr"/>
184182
<binding destination="58" name="selectedIndex" keyPath="values.MMLastWindowClosedBehavior" id="968"/>
185183
</connections>
186184
</popUpButton>

src/MacVim/MMAppController.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -548,17 +548,6 @@ - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
548548

549549
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
550550
{
551-
if (MMUntitledWindowNever ==
552-
[[NSUserDefaults standardUserDefaults]
553-
integerForKey:MMUntitledWindowKey]) {
554-
// Sanity protection: If we never open a new window on application launch, there could
555-
// be an issue here where we immediately terminate MacVim. Because of that, we always
556-
// return false regardless of what MMLastWindowClosedBehavior is. Note that the user
557-
// should not be able to set these two conflicting options together in the preference pane
558-
// but it's possible to do so in the terminal by calling "defaults" manually.
559-
return false;
560-
}
561-
562551
return (MMTerminateWhenLastWindowClosed ==
563552
[[NSUserDefaults standardUserDefaults]
564553
integerForKey:MMLastWindowClosedBehaviorKey]);

src/MacVim/MMPreferenceController.m

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -167,36 +167,6 @@ - (IBAction)fontPropertiesChanged:(id)sender
167167
[[MMAppController sharedInstance] refreshAllFonts];
168168
}
169169

170-
-(IBAction)lastWindowClosedChanged:(id)sender
171-
{
172-
// Sanity checking for terminate when last window closed + not opening an untitled window.
173-
// This results in a potentially awkward situation wehre MacVim will close itself since it
174-
// doesn't have any window opened when launched.
175-
// Note that the potentially bad behavior is already protected against for in applicationShouldTerminateAfterLastWindowClosed:,
176-
// but this sanity checking is to make sure the user can see that in an explicit fashion.
177-
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
178-
if ([defaults integerForKey:MMLastWindowClosedBehaviorKey] == MMTerminateWhenLastWindowClosed) {
179-
if ([defaults integerForKey:MMUntitledWindowKey] == MMUntitledWindowNever) {
180-
[defaults setInteger:MMUntitledWindowOnOpen forKey:MMUntitledWindowKey];
181-
}
182-
}
183-
}
184-
185-
-(IBAction)openUntitledWindowChanged:(id)sender
186-
{
187-
// Sanity checking for terminate when last window closed + not opening an untitled window.
188-
// This results in a potentially awkward situation wehre MacVim will close itself since it
189-
// doesn't have any window opened when launched.
190-
// Note that the potentially bad behavior is already protected against for in applicationShouldTerminateAfterLastWindowClosed:,
191-
// but this sanity checking is to make sure the user can see that in an explicit fashion.
192-
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
193-
if ([defaults integerForKey:MMLastWindowClosedBehaviorKey] == MMTerminateWhenLastWindowClosed) {
194-
if ([defaults integerForKey:MMUntitledWindowKey] == MMUntitledWindowNever) {
195-
[defaults setInteger:MMHideWhenLastWindowClosed forKey:MMLastWindowClosedBehaviorKey];
196-
}
197-
}
198-
}
199-
200170
- (IBAction)smoothResizeChanged:(id)sender
201171
{
202172
[[MMAppController sharedInstance] refreshAllResizeConstraints];

0 commit comments

Comments
 (0)