aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-05-09 23:27:05 +0000
committerrowanbeentje <rowan@beent.je>2010-05-09 23:27:05 +0000
commit4bd80e43ae255768c57095cfaa45f2ff6859a1bd (patch)
treecea5092df665595262c8b3024c0460c57a3fed60 /Source/CustomQuery.m
parent1f3218fff6d606d4cc9a9bd3bcef0919fa536fda (diff)
downloadsequelpro-4bd80e43ae255768c57095cfaa45f2ff6859a1bd.tar.gz
sequelpro-4bd80e43ae255768c57095cfaa45f2ff6859a1bd.tar.bz2
sequelpro-4bd80e43ae255768c57095cfaa45f2ff6859a1bd.zip
- Fix a problem caused when trying to run custom queries terminated by a partial letterform, eg an unapplied accent. (Addresses http://spbug.com/l/260)
Diffstat (limited to 'Source/CustomQuery.m')
-rw-r--r--Source/CustomQuery.m4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 79f55545..7df5615f 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -150,6 +150,10 @@
// and preserve the selection
[textView setSelectedRange:NSMakeRange(selectedRange.location, 0)];
[textView insertText:@""];
+
+ // Inserting empty text may have cancelled a partial accent - range check before
+ // restoring the selection.
+ if (selectedRange.location > [[textView string] length]) selectedRange.location = [[textView string] length];
[textView setSelectedRange:selectedRange];
reloadingExistingResult = NO;