aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-11-20 23:23:22 +0000
committerrowanbeentje <rowan@beent.je>2012-11-20 23:23:22 +0000
commita2acd2dfa7eec5724f1c0234ecc03ec20100bde3 (patch)
treeadd85edde0352f51dd92865bd92151e514b8bbff /Source
parent493e8a2543e0d62d9105e3edb257983f1831e6d4 (diff)
downloadsequelpro-a2acd2dfa7eec5724f1c0234ecc03ec20100bde3.tar.gz
sequelpro-a2acd2dfa7eec5724f1c0234ecc03ec20100bde3.tar.bz2
sequelpro-a2acd2dfa7eec5724f1c0234ecc03ec20100bde3.zip
- Improve use of the table content filter, no longer removing focus from it when a filter is triggered by deleting the contents (Issue #1496)
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableContent.m19
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 9cd7f205..d44a0558 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -1488,6 +1488,12 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
*/
- (IBAction)filterTable:(id)sender
{
+
+ // Record whether the filter is being triggered by using delete/backspace in the filter field, which
+ // can trigger the effect of clicking the "clear filter" button in the field.
+ // (Keycode 51 is backspace, 117 is delete.)
+ BOOL deleteTriggeringFilter = ([sender isKindOfClass:[NSSearchField class]] && ([[[sender window] currentEvent] keyCode] == 51 || [[[sender window] currentEvent] keyCode] == 117));
+
#ifndef SP_REFACTOR
if(sender == filterTableFilterButton)
@@ -1505,15 +1511,18 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
if ([tableDocumentInstance isWorking]) return;
- // Check whether a save of the current row is required
- if (![self saveRowOnDeselect]) return;
-
// If the filter field is being cleared by deleting the contents, and there's no current filter,
- // don't trigger a reload. keycode 51 is backspace, 117 is delete.
- if ([sender isKindOfClass:[NSSearchField class]] && !isFiltered && ![self tableFilterString] && ([[[sender window] currentEvent] keyCode] == 51 || [[[sender window] currentEvent] keyCode] == 117)) {
+ // don't trigger a reload.
+ if (deleteTriggeringFilter && !isFiltered && ![self tableFilterString]) {
return;
}
+ // Check whether a save of the current row is required, restoring focus afterwards if appropriate
+ if (![self saveRowOnDeselect]) return;
+ if (deleteTriggeringFilter) {
+ [sender becomeFirstResponder];
+ }
+
#ifndef SP_REFACTOR
[self setPaginationViewVisibility:FALSE];
#endif