From 1c936a29bdd7da08e61603caec2f20aeed119135 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 15 Sep 2009 00:05:33 +0000 Subject: Improve .sql file loading into the query editor: - Allow undo of the insertion - Update scrollbar size/position after the update - Ensure the cursor is scrolled to --- Source/CustomQuery.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Source/CustomQuery.m') diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 0a2958ee..f393dc45 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -1107,13 +1107,18 @@ */ - (void)doPerformQueryService:(NSString *)query { + [textView shouldChangeTextInRange:NSMakeRange(0, [[textView string] length]) replacementString:query]; [textView setString:query]; + [textView didChangeText]; + [textView scrollRangeToVisible:NSMakeRange([query length], 0)]; [self runAllQueries:self]; } - (void)doPerformLoadQueryService:(NSString *)query { + [textView shouldChangeTextInRange:NSMakeRange(0, [[textView string] length]) replacementString:query]; [textView setString:query]; - // [textView insertText:@""]; + [textView didChangeText]; + [textView scrollRangeToVisible:NSMakeRange([query length], 0)]; } - (NSString *)usedQuery -- cgit v1.2.3