mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Fix file names with spaces not working in the contextual menu
Files with spaces end up with 4 extra spaces after the name. This stops them from working with the various commands in the contextual menus.
This commit is contained in:
committed by
Dave Grijalva
parent
2e549a18f8
commit
1917bca23b
@@ -287,7 +287,11 @@
|
||||
|
||||
- (NSArray *)menuItemsForPaths:(NSArray *)paths
|
||||
{
|
||||
BOOL multiple = [paths count] != 1;
|
||||
NSMutableArray *filePaths = [NSMutableArray array];
|
||||
for (NSString *filePath in paths)
|
||||
[filePaths addObject:[filePath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
|
||||
|
||||
BOOL multiple = [filePaths count] != 1;
|
||||
NSMenuItem *historyItem = [[NSMenuItem alloc] initWithTitle:multiple? @"Show history of files" : @"Show history of file"
|
||||
action:@selector(showCommitsFromTree:)
|
||||
keyEquivalent:@""];
|
||||
@@ -301,7 +305,7 @@
|
||||
NSArray *menuItems = [NSArray arrayWithObjects:historyItem, finderItem, openFilesItem, nil];
|
||||
for (NSMenuItem *item in menuItems) {
|
||||
[item setTarget:self];
|
||||
[item setRepresentedObject:paths];
|
||||
[item setRepresentedObject:filePaths];
|
||||
}
|
||||
|
||||
return menuItems;
|
||||
|
||||
Reference in New Issue
Block a user