Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1917bca

Browse files
brotherbarddgrijalva
authored andcommittedMar 21, 2010
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.
1 parent 2e549a1 commit 1917bca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎PBGitHistoryController.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,11 @@ - (NSMenu *)contextMenuForTreeView
287287

288288
- (NSArray *)menuItemsForPaths:(NSArray *)paths
289289
{
290-
BOOL multiple = [paths count] != 1;
290+
NSMutableArray *filePaths = [NSMutableArray array];
291+
for (NSString *filePath in paths)
292+
[filePaths addObject:[filePath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
293+
294+
BOOL multiple = [filePaths count] != 1;
291295
NSMenuItem *historyItem = [[NSMenuItem alloc] initWithTitle:multiple? @"Show history of files" : @"Show history of file"
292296
action:@selector(showCommitsFromTree:)
293297
keyEquivalent:@""];
@@ -301,7 +305,7 @@ - (NSArray *)menuItemsForPaths:(NSArray *)paths
301305
NSArray *menuItems = [NSArray arrayWithObjects:historyItem, finderItem, openFilesItem, nil];
302306
for (NSMenuItem *item in menuItems) {
303307
[item setTarget:self];
304-
[item setRepresentedObject:paths];
308+
[item setRepresentedObject:filePaths];
305309
}
306310

307311
return menuItems;

0 commit comments

Comments
 (0)
Please sign in to comment.