From 6e92d077ce41783510530cea3e0df38614345e8e Mon Sep 17 00:00:00 2001
From: Nathan Kinsinger <[email protected]>
Date: Sat, 6 Mar 2010 16:41:49 -0700
Subject: [PATCH] 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.
---
PBGitHistoryController.m | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m
index b4a5d66..242777d 100644
--- a/PBGitHistoryController.m
+++ b/PBGitHistoryController.m
@@ -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;
--
1.7.0+GitX