diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 3a55ffe551..53e7a80082 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -117,7 +117,6 @@ typedef struct #endif - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event replyEvent:(NSAppleEventDescriptor *)reply; -- (MMVimController *)findUnusedEditor; - (NSMutableDictionary *)extractArgumentsFromOdocEvent: (NSAppleEventDescriptor *)desc; - (void)scheduleVimControllerPreloadAfterDelay:(NSTimeInterval)delay; @@ -1716,18 +1715,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef, } } -- (MMVimController *)findUnusedEditor -{ - NSEnumerator *e = [vimControllers objectEnumerator]; - id vc; - while ((vc = [e nextObject])) { - if ([[vc objectForVimStateKey:@"unusedEditor"] boolValue]) - return vc; - } - - return nil; -} - - (NSMutableDictionary *)extractArgumentsFromOdocEvent: (NSAppleEventDescriptor *)desc { @@ -2009,15 +1996,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments { - MMVimController *vc = [self findUnusedEditor]; + MMVimController *vc = [self takeVimControllerFromCache]; if (vc) { - // Open files in an already open window. - // TODO: If the file is encrypted (with -x) then opening in an unused - // window will fail if there are more arguments than just the filename - // (the same goes with cached Vim controllers). - [[[vc windowController] window] makeKeyAndOrderFront:self]; - [vc passArguments:arguments]; - } else if ((vc = [self takeVimControllerFromCache])) { // Open files in a new window using a cached vim controller. This // requires virtually no loading time so the new window will pop up // instantaneously. diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 17b038647f..4c6291e69b 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -1713,7 +1713,6 @@ static void netbeansReadCallback(CFSocketRef s, NSDictionary *vimState = [NSDictionary dictionaryWithObjectsAndKeys: [[NSFileManager defaultManager] currentDirectoryPath], @"pwd", [NSNumber numberWithInt:p_mh], @"p_mh", - [NSNumber numberWithBool:[self unusedEditor]], @"unusedEditor", [NSNumber numberWithBool:mmta], @"p_mmta", [NSNumber numberWithInt:numTabs], @"numTabs", nil]; diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index ae376219b9..279cf8f8b0 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -324,17 +324,6 @@ static BOOL isUnsafeMessage(int msgid); ASLogDebug(@"args=%@", args); [self sendMessage:OpenWithArgumentsMsgID data:[args dictionaryAsData]]; - - // HACK! Fool findUnusedEditor into thinking that this controller is not - // unused anymore, in case it is called before the arguments have reached - // the Vim process. This should be a "safe" hack since the next time the - // Vim process flushes its output queue the state will be updated again (at - // which time the "unusedEditor" state will have been properly set). - NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary: - vimState]; - [dict setObject:[NSNumber numberWithBool:NO] forKey:@"unusedEditor"]; - [vimState release]; - vimState = [dict copy]; } - (void)sendMessage:(int)msgid data:(NSData *)data