diff options
author | rowanbeentje <rowan@beent.je> | 2012-05-31 22:33:42 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-05-31 22:33:42 +0000 |
commit | 74605c185982d0f1882b8acbdd2d1703aadc1c40 (patch) | |
tree | 971c225144e0b94d87de6f1bee095fa651ac0bf2 | |
parent | 8e22ba45ee2376ebc050332e04081693d60968bc (diff) | |
download | sequelpro-74605c185982d0f1882b8acbdd2d1703aadc1c40.tar.gz sequelpro-74605c185982d0f1882b8acbdd2d1703aadc1c40.tar.bz2 sequelpro-74605c185982d0f1882b8acbdd2d1703aadc1c40.zip |
- Fix some text reselection logic when running all queries, which appears to be legacy code from r600 (!) when the queries were run in a non-threaded manner. This addresses Issue #1337.
-rw-r--r-- | Source/SPCustomQuery.h | 3 | ||||
-rw-r--r-- | Source/SPCustomQuery.m | 35 |
2 files changed, 1 insertions, 37 deletions
diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h index 943c307d..10d3b6eb 100644 --- a/Source/SPCustomQuery.h +++ b/Source/SPCustomQuery.h @@ -133,7 +133,6 @@ NSString *usedQuery; NSRange currentQueryRange; NSArray *currentQueryRanges; - NSRange oldThreadedQueryRange; BOOL selectionButtonCanBeEnabled; NSString *mySQLversion; @@ -170,7 +169,6 @@ NSString *fieldIDQueryString; NSUInteger numberOfQueries; - NSUInteger queryTextViewStartPosition; NSUInteger queryInfoPanePaddingHeight; NSInteger currentHistoryOffsetIndex; @@ -197,7 +195,6 @@ // IBAction methods - (IBAction)runAllQueries:(id)sender; -- (void) runAllQueriesCallback; - (IBAction)runSelectedQueries:(id)sender; - (IBAction)chooseQueryFavorite:(id)sender; - (IBAction)chooseQueryHistory:(id)sender; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index f0edf945..4d61461f 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -115,40 +115,13 @@ [queryParser release]; - oldThreadedQueryRange = [textView selectedRange]; - - // Unselect a selection if given to avoid interfering with error highlighting - [textView setSelectedRange:NSMakeRange(oldThreadedQueryRange.location, 0)]; - // Reset queryStartPosition queryStartPosition = 0; reloadingExistingResult = NO; [self clearResultViewDetailsToRestore]; - // Remember query start position for error highlighting - queryTextViewStartPosition = 0; - - [self performQueries:queries withCallback:@selector(runAllQueriesCallback)]; -} - -- (void)runAllQueriesCallback -{ - // If no error was selected, reconstruct a given selection. This - // may no longer be valid if the query text has changed in the - // meantime, so error-checking is required. - if (oldThreadedQueryRange.location + oldThreadedQueryRange.length <= [[textView string] length]) { - - if ([textView selectedRange].length == 0) - [textView setSelectedRange:oldThreadedQueryRange]; - - // Invoke textStorageDidProcessEditing: for syntax highlighting and auto-uppercase - NSRange oldRange = [textView selectedRange]; - [textView setSelectedRange:NSMakeRange(oldThreadedQueryRange.location,0)]; - [textView insertText:@""]; - [textView setSelectedRange:oldRange]; - [textView scrollRangeToVisible:oldRange]; - } + [self performQueries:queries withCallback:NULL]; } /* @@ -182,9 +155,6 @@ } queries = [NSArray arrayWithObject:[SPSQLParser normaliseQueryForExecution:query]]; - // Remember query start position for error highlighting - queryTextViewStartPosition = currentQueryRange.location; - // Otherwise, run the selected text. } else { queryParser = [[SPSQLParser alloc] initWithString:[[textView string] substringWithRange:selectedRange]]; @@ -201,9 +171,6 @@ } [queryParser release]; - - // Remember query start position for error highlighting - queryTextViewStartPosition = selectedRange.location; } // Invoke textStorageDidProcessEditing: for syntax highlighting and auto-uppercase |