This commit is contained in:
Corey Johnson 2011-11-09 10:38:25 -08:00
parent d0ac88ae64
commit 7a567dab69
6 changed files with 26 additions and 38 deletions

View File

@ -65,43 +65,6 @@
return tmpPathString;
}
- (NSArray *)scan:(NSString *)rootPath select:(JSValueRefAndContextRef)selectCallback compare:(JSValueRefAndContextRef)compareCallback{
struct dirent **files;
int (^select)(struct dirent *) = nil;
if (selectCallback.value) {
select = ^(struct dirent *namelist) {
return 1;
};
}
int (^compare)(const void *, const void *) = nil;
if (compareCallback.value) {
compare = ^(const void *pathOne, const void *pathTwo) {
return 1;
};
}
int count = scandir_b([rootPath UTF8String], &files, select, compare);
NSMutableArray *results = [NSMutableArray array];
for (int i = 0; i < count; i++) {
if (strncmp(files[i]->d_name, ".", files[i]->d_namlen) == 0) {
continue;
}
else if (strncmp(files[i]->d_name, ".", files[i]->d_namlen) == 0) {
continue;
}
NSString *name = [[NSString alloc] initWithBytes:files[i]->d_name length:files[i]->d_namlen encoding:NSUTF8StringEncoding];
[results addObject:name];
[name release];
free(files[i]);
}
free(files);
return results;
}
// WebUIDelegate
- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems {
return defaultMenuItems;

5
docs/corey-wants.txt Normal file
View File

@ -0,0 +1,5 @@
- cmd-shift-t: reopen last closed tab
- an extension that shows all available key commands

View File

@ -48,7 +48,7 @@ class Tree extends Extension
@.constructor.name + ":" + window.path + ":shownDirs"
watchDir: (changeType, dir) =>
# Update the paths.
# Update the paths
@paths = @findPaths window.path
@pane.reload()

View File

@ -51,6 +51,9 @@ class KeyBinder
keys.push @modifierKeys.alt if event.modifierFlags & OSX.NSAlternateKeyMask
keys.push event.charactersIgnoringModifiers.toLowerCase().charCodeAt 0
console.log event.charactersIgnoringModifiers.toLowerCase()
console.log event.charactersIgnoringModifiers.valueOf()
binding = keys.sort().join "-"
callbacks = @bindings[binding]

15
src/project.coffee Normal file
View File

@ -0,0 +1,15 @@
module.exports =
class Project
@scan: (path, selectCallback, sortCallback) ->
fs = OSX.NSFileManager.defaultManager
dirEnumerator = fs.enumeratorAtPath rootPath
results = []
while path = dirEnumerator.nextObject
path = path.valueOf()
if not selectCallback or selectCallback(path)
results.push path
results.sort sortCallback if sortCallback
results

View File

@ -27,6 +27,8 @@ windowAdditions =
@path = $atomController.path
@setTitle _.last @path.split '/'
$atomController.scan_select_compare(@path, null, null)
# Remember sizing!
defaultFrame = x: 0, y: 0, width: 600, height: 800