Skip to content

Commit

Permalink
Partially fix issue #3294 - allow users to deselect all rows by ESC w…
Browse files Browse the repository at this point in the history
…hen more than one row is selected
  • Loading branch information
Kaspik committed Feb 20, 2019
1 parent 37f6283 commit 77d58ec
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Source/SPTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,17 @@ - (void)keyDown:(NSEvent *)theEvent
}
}

// Check if ESCAPE is hit and use it to cancel row editing if supported
else if ([theEvent keyCode] == 53 && [[self delegate] respondsToSelector:@selector(cancelRowEditing)]) {
if ([(id<SPTableViewDelegate>)[self delegate] cancelRowEditing]) return;
// Check if ESCAPE is hit
else if ([theEvent keyCode] == 53) {
// Use it to cancel row editing if supported
if ([[self delegate] respondsToSelector:@selector(cancelRowEditing)]) {
if ([(id<SPTableViewDelegate>)[self delegate] cancelRowEditing]) return;
}
// If more rows is selected, cancel selection of all
else if ([self numberOfSelectedRows] > 1) {
[self deselectAll:nil];
}
return;
}

// If the Tab key is used, but tab editing is disabled, change focus rather than entering edit mode.
Expand Down

1 comment on commit 77d58ec

@dmoagx
Copy link
Member

@dmoagx dmoagx commented on 77d58ec Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should ESC clear the selection?
Where else is it implemented like that in the OS?

Please sign in to comment.