mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Add files opened/saved from :browse to "Recent Files" menu
This commit is contained in:
@@ -292,10 +292,8 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
// Don't add files that are being edited remotely (using ODB).
|
||||
if ([arguments objectForKey:@"remoteID"]) continue;
|
||||
|
||||
NSURL *url = [NSURL fileURLWithPath:[filenames objectAtIndex:i]];
|
||||
if (!url) continue;
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
noteNewRecentDocumentURL:url];
|
||||
noteNewRecentFilePath:[filenames objectAtIndex:i]];
|
||||
}
|
||||
|
||||
if ((openInTabs && (vc = [self topmostVimController]))
|
||||
|
||||
@@ -922,9 +922,15 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
|
||||
context:(void *)context
|
||||
{
|
||||
NSString *string = (code == NSOKButton) ? [panel filename] : nil;
|
||||
NSString *path = (code == NSOKButton) ? [panel filename] : nil;
|
||||
@try {
|
||||
[backendProxy setDialogReturn:string];
|
||||
[backendProxy setDialogReturn:path];
|
||||
|
||||
// Add file to the "Recent Files" menu (this ensures that files that
|
||||
// are opened/saved from a :browse command are added to this menu).
|
||||
if (path)
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
noteNewRecentFilePath:path];
|
||||
}
|
||||
@catch (NSException *e) {
|
||||
NSLog(@"Exception caught in %s %@", _cmd, e);
|
||||
|
||||
@@ -277,6 +277,13 @@ NSString *buildSearchTextCommand(NSString *searchText);
|
||||
|
||||
|
||||
|
||||
@interface NSDocumentController (MMExtras)
|
||||
- (void)noteNewRecentFilePath:(NSString *)path;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
// ODB Editor Suite Constants (taken from ODBEditorSuite.h)
|
||||
#define keyFileSender 'FSnd'
|
||||
#define keyFileSenderToken 'FTok'
|
||||
|
||||
@@ -294,3 +294,17 @@ buildSearchTextCommand(NSString *searchText)
|
||||
|
||||
@end // NSColor (MMExtras)
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation NSDocumentController (MMExtras)
|
||||
|
||||
- (void)noteNewRecentFilePath:(NSString *)path
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath:path];
|
||||
if (url)
|
||||
[self noteNewRecentDocumentURL:url];
|
||||
}
|
||||
|
||||
@end // NSDocumentController (MMExtras)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user