aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTextView.m
diff options
context:
space:
mode:
authorsqlprodev <sqlprodev@northofthree.com>2011-05-19 22:47:53 +0000
committersqlprodev <sqlprodev@northofthree.com>2011-05-19 22:47:53 +0000
commitc80db3a0d26b394b9c88fc6ef19a90cda5340440 (patch)
treed79af344b053e24393864382958e490f4b844735 /Source/SPTextView.m
parent838faafed7af37723e8f900a6cba846a29507db2 (diff)
downloadsequelpro-c80db3a0d26b394b9c88fc6ef19a90cda5340440.tar.gz
sequelpro-c80db3a0d26b394b9c88fc6ef19a90cda5340440.tar.bz2
sequelpro-c80db3a0d26b394b9c88fc6ef19a90cda5340440.zip
merging SP_REFACTOR branch with trunk
Diffstat (limited to 'Source/SPTextView.m')
-rw-r--r--Source/SPTextView.m18
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index cb0e4d9e..b08db401 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -102,6 +102,12 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS
@synthesize completionIsOpen;
@synthesize completionWasReinvokedAutomatically;
+#ifdef SP_REFACTOR
+@synthesize tableDocumentInstance;
+@synthesize tablesListInstance;
+@synthesize customQueryInstance;
+#endif
+
/**
* Sort function (mainly used to sort the words in the textView)
*/
@@ -1953,10 +1959,10 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
[self insertText:snip];
// If autopair is enabled check whether snip begins with ( and ends with ), if so mark ) as pair-linked
+ if (
#ifndef SP_REFACTOR
- if ([prefs boolForKey:SPCustomQueryAutoPairCharacters] &&
+ [prefs boolForKey:SPCustomQueryAutoPairCharacters] &&
#else
- if (
#endif
(([snip hasPrefix:@"("] && [snip hasSuffix:@")"])
|| ([snip hasPrefix:@"`"] && [snip hasSuffix:@"`"])
@@ -2170,8 +2176,10 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
// Check for {SHIFT}TAB to try to insert query favorite via TAB trigger if SPTextView belongs to SPCustomQuery
// and TAB as soft indention
if ([theEvent keyCode] == 48 && [self isEditable] && [[self delegate] isKindOfClass:[SPCustomQuery class]]){
+#ifndef SP_REFACTOR
NSRange targetRange = [self getRangeForCurrentWord];
NSString *tabTrigger = [[self string] substringWithRange:targetRange];
+#endif
// Is TAB trigger active change selection according to {SHIFT}TAB
if(snippetControlCounter > -1){
@@ -2214,6 +2222,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
}
+#ifndef SP_REFACTOR
// Check if tab trigger is defined; if so insert it, otherwise pass through event
if(snippetControlCounter < 0 && [tabTrigger length] && [tableDocumentInstance fileURL]) {
NSArray *snippets = [[SPQueryController sharedQueryController] queryFavoritesForFileURL:[tableDocumentInstance fileURL] andTabTrigger:tabTrigger includeGlobals:YES];
@@ -2225,7 +2234,6 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
// Check for TAB as indention for current line, i.e. left of the caret there are only white spaces
// but only if Soft Indent is set
-#ifndef SP_REFACTOR
if([prefs boolForKey:SPCustomQuerySoftIndent] && [self isCaretAtIndentPositionIgnoreLineStart:YES]) {
if([self shiftSelectionRight]) return;
}
@@ -3412,7 +3420,11 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
}
// Check size and NSFileType
+#ifndef SP_REFACTOR
NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filepath traverseLink:YES];
+#else
+ NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:filepath error:nil];
+#endif
if(attr)
{
NSNumber *filesize = [attr objectForKey:NSFileSize];