Skip to content

Commit

Permalink
Fixed erroneous start of editing in results view
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbaer committed Jun 12, 2013
1 parent 0548487 commit 5b81b82
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
19 changes: 13 additions & 6 deletions English.lproj/ResultsView.nib/designable.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified English.lproj/ResultsView.nib/keyedobjects.nib
Binary file not shown.
26 changes: 10 additions & 16 deletions Source/PAResultsOutlineView.m
Original file line number Diff line number Diff line change
Expand Up @@ -748,18 +748,24 @@ - (void)mouseDown:(NSEvent *)theEvent
[NSObject cancelPreviousPerformRequestsWithTarget:self
selector:@selector(beginEditing)
object:nil];

// Do only something if this row is not being edited and the user wants to
// cancel the editing by clicking again on the item
if (![self isEditingRow:mouseRow] && (mouseRow != -1))

/* TODO [self editedRow] is not working and always returns -1 in the current
* implementation. Set the edited row manually, and then a click anywhere else
* than the field editor in the edited row should cancel the editing.
*/

if (mouseRow != -1)
{
NSInteger count = [[self selectedRowIndexes] count];
if([self selectedRow] == mouseRow && count <= 1)
{
// perform editing like finder
[self performSelector:@selector(beginEditing)
withObject:nil
afterDelay:doubleClickThreshold];
afterDelay:doubleClickThreshold];
}
else if([[self selectedRowIndexes] containsIndex:mouseRow])
{
Expand All @@ -780,7 +786,7 @@ - (void)mouseDown:(NSEvent *)theEvent
[NSObject cancelPreviousPerformRequestsWithTarget:self
selector:@selector(beginEditing)
object:nil];

// cancel the row-selection action
[NSObject cancelPreviousPerformRequestsWithTarget:self
selector:@selector(selectOnlyRowIndexes:)
Expand Down Expand Up @@ -886,18 +892,6 @@ - (void)setSelectedItems:(NSArray *)theItems
selectedItems = [[NSMutableArray alloc] initWithArray:theItems];
}

- (BOOL)isEditingRow:(NSInteger)row
{
if ([self numberOfSelectedItems] != 1)
return NO;

if ([self rowForItem:[[self selectedItems] objectAtIndex:0]] != row)
return NO;

NSText *textView = [[self window] fieldEditor:NO forObject:self];
return [textView isFieldEditor];
}


#pragma mark Editing
- (void)beginEditing
Expand Down

0 comments on commit 5b81b82

Please sign in to comment.