Skip to content
Snippets Groups Projects
Commit 72d55b22 authored by Jack Chen (chendo)'s avatar Jack Chen (chendo)
Browse files

Command + Option + Click does `cd <path>; ls` if it is a directory.

parent d58bc9d4
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -490,6 +490,9 @@ typedef enum {
- (void)logWorkingDirectoryAtLine:(long long)line;
- (NSString *)getWorkingDirectoryAtLine:(long long)line;
 
// Trouter change directory
- (void)_changeDirectory:(NSString *)path;
- (BOOL)_findMatchingParenthesis:(NSString *)parenthesis withX:(int)X Y:(int)Y;
- (void)_dragText:(NSString *)aString forEvent:(NSEvent *)theEvent;
- (BOOL)_isCharSelectedInRow:(int)row col:(int)col checkOld:(BOOL)old;
Loading
Loading
Loading
Loading
@@ -2222,9 +2222,17 @@ static BOOL RectsEqual(NSRect* a, NSRect* b) {
[mouseDownEvent locationInWindow].x == [event locationInWindow].x &&
[mouseDownEvent locationInWindow].y == [event locationInWindow].y) {
// Command click in place.
//[self _openURL: [self selectedText]];
NSString *url = [self _getURLForX:x y:y];
if (url != nil) {
if (url &&[event modifierFlags] & NSAlternateKeyMask) {
NSString *fullPath = [trouter getFullPath:url
workingDirectory:[self getWorkingDirectoryAtLine:y + 1]
lineNumber:nil];
if ([trouter isDirectory:fullPath]) {
[self _changeDirectory:url];
}
}
else {
[self _openURL:url atLine:y + 1];
}
} else {
Loading
Loading
@@ -5687,6 +5695,10 @@ static bool IsUrlChar(NSString* str)
return [[workingDirectoryAtLines lastObject] lastObject];
}
 
- (void)_changeDirectory:(NSString *)path {
[[dataSource shellTask] writeTask:[[NSString stringWithFormat:@"cd \"%@\"; ls\n", path] dataUsingEncoding:[[dataSource session] encoding]]];
}
- (void)_openURL:(NSString *)aURLString atLine:(long long)line {
NSString* trimmedURLString;
Loading
Loading
Loading
Loading
@@ -38,6 +38,8 @@
- (void) determineEditor;
- (BOOL) applicationExists:(NSString *)bundle_id;
- (BOOL) applicationExists:(NSString *)bundle_id path:(NSString **)path;
- (BOOL) isTextFile:(NSString *)path;
- (BOOL) isDirectory:(NSString *)path;
- (NSFileManager *) fileManager;
- (NSString *) getFullPath:(NSString *)path workingDirectory:(NSString *)workingDirectory lineNumber:(NSString **)lineNumber;
- (void) openPath:(NSString *)path workingDirectory:(NSString *)workingDirectory;
Loading
Loading
Loading
Loading
@@ -90,6 +90,12 @@
}
}
 
- (BOOL) isDirectory:(NSString *)path {
BOOL ret;
[fileManager fileExistsAtPath:path isDirectory:&ret];
return ret;
}
- (BOOL) isTextFile:(NSString *)path {
BOOL ret = FALSE;
MDItemRef item = MDItemCreate(kCFAllocatorDefault, (CFStringRef)path);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment