diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-10-12 19:06:16 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-10-12 19:06:16 +0000 |
commit | 890022a6a462a2e7792379e316fa3866e737ff5c (patch) | |
tree | 9fc396283e8eda50c674b5b5af9fc2d78cb40be7 /Source | |
parent | 1ce6245b609179935da05c90735a1607c1949d2e (diff) | |
download | sequelpro-890022a6a462a2e7792379e316fa3866e737ff5c.tar.gz sequelpro-890022a6a462a2e7792379e316fa3866e737ff5c.tar.bz2 sequelpro-890022a6a462a2e7792379e316fa3866e737ff5c.zip |
• fixed cursor position correction for autoHelp
- should fix among other issues i862
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPTextView.m | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 84322397..32f97c15 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -2484,7 +2484,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) - (void)autoHelp { - if(![prefs boolForKey:SPCustomQueryUpdateAutoHelp]) return; + if(![prefs boolForKey:SPCustomQueryUpdateAutoHelp] || ![[self string] length]) return; // If selection show Help for it if([self selectedRange].length) @@ -2494,8 +2494,9 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) } // Otherwise show Help if caret is not inside quotes NSUInteger cursorPosition = [self selectedRange].location; - if (cursorPosition >= [[self string] length]) cursorPosition--; - if(cursorPosition >= 0 && ![(NSString*)NSMutableAttributedStringAttributeAtIndex([self textStorage], kQuote, cursorPosition, nil) length]) + // If cursor at the end go one char leftwards + if (cursorPosition > 0 && cursorPosition >= [[self string] length]) cursorPosition--; + if (cursorPosition < [[self string] length] && ![(NSString*)NSMutableAttributedStringAttributeAtIndex([self textStorage], kQuote, cursorPosition, nil) length]) [customQueryInstance performSelector:@selector(showAutoHelpForCurrentWord:) withObject:self afterDelay:0.1]; } |