From 6d70e1a1791004cb877a535ec3917bbe6cf101f8 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sun, 8 Feb 2009 22:29:58 +0100 Subject: [PATCH] Fix untitled window on reopen with quickstart This reverts commit 662aa32b399c1149daa1cd3a2b5bccc8e75f589a and clarifies the comment regarding how 'pidArguments' is used. --- src/MacVim/MMAppController.m | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index b171547ab7..7b05074144 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -1331,10 +1331,21 @@ fsEventCallback(ConstFSEventStreamRef streamRef, } if (-1 != pid) { - // Add a null argument to the pidArguments dictionary. This is later - // used to detect that a process without arguments is being launched. - [pidArguments setObject:[NSNull null] - forKey:[NSNumber numberWithInt:pid]]; + // The 'pidArguments' dictionary keeps arguments to be passed to the + // process when it connects (this is in contrast to arguments which are + // passed on the command line, like '-f' and '-g'). + // If this method is called with nil arguments we take this as a hint + // that this is an "untitled window" being launched and add a null + // object to the 'pidArguments' dictionary. This way we can detect if + // an untitled window is being launched by looking for null objects in + // this dictionary. + // If this method is called with non-nil arguments then it is assumed + // that the caller takes care of adding items to 'pidArguments' as + // necessary (only some arguments are passed on connect, e.g. files to + // open). + if (!args) + [pidArguments setObject:[NSNull null] + forKey:[NSNumber numberWithInt:pid]]; } else { NSLog(@"WARNING: %s%@ failed (useLoginShell=%d)", _cmd, args, useLoginShell);