aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTextViewAdditions.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-03-19 15:05:23 +0000
committerstuconnolly <stuart02@gmail.com>2011-03-19 15:05:23 +0000
commit6d3f21336846d7745e795202c99390832c4220c8 (patch)
tree6195dafeeb1871afc5e41f6f17a917dc8047d44a /Source/SPTextViewAdditions.m
parentb2a0af91eae18b6490ddeafd2708d256b0d53cb3 (diff)
downloadsequelpro-6d3f21336846d7745e795202c99390832c4220c8.tar.gz
sequelpro-6d3f21336846d7745e795202c99390832c4220c8.tar.bz2
sequelpro-6d3f21336846d7745e795202c99390832c4220c8.zip
Bring outline view branch up to date with trunk (r3235:r3245), which should resolve all warnings.
Diffstat (limited to 'Source/SPTextViewAdditions.m')
-rw-r--r--Source/SPTextViewAdditions.m41
1 files changed, 21 insertions, 20 deletions
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index e3f8b714..0d3b4b8e 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -27,6 +27,10 @@
#import "SPBundleHTMLOutputController.h"
#import "SPCustomQuery.h"
#import "SPAppController.h"
+#import "SPFieldEditorController.h"
+#import "SPTextView.h"
+#import "SPWindowController.h"
+#import "SPDatabaseDocument.h"
@implementation NSTextView (SPTextViewAdditions)
@@ -42,34 +46,33 @@
if (curRange.length)
return curRange;
- NSInteger curLocation = curRange.location;
+ NSUInteger curLocation = curRange.location;
NSInteger start = curLocation;
- NSInteger end = curLocation;
+ NSUInteger end = curLocation;
NSUInteger strLen = [[self string] length];
NSMutableCharacterSet *wordCharSet = [NSMutableCharacterSet alphanumericCharacterSet];
[wordCharSet addCharactersInString:@"_."];
[wordCharSet removeCharactersInString:@"`"];
- if(start) {
+ if (start) {
start--;
- while([wordCharSet characterIsMember:[[self string] characterAtIndex:start]]) {
+ while ([wordCharSet characterIsMember:[[self string] characterAtIndex:start]]) {
start--;
if(start < 0) break;
}
start++;
}
- while(end < strLen && [wordCharSet characterIsMember:[[self string] characterAtIndex:end]]) {
+ while (end < strLen && [wordCharSet characterIsMember:[[self string] characterAtIndex:end]]) {
end++;
}
NSRange wordRange = NSMakeRange(start, end-start);
- if(wordRange.length && [[self string] characterAtIndex:NSMaxRange(wordRange)-1] == '.')
+ if (wordRange.length && [[self string] characterAtIndex:NSMaxRange(wordRange)-1] == '.')
wordRange.length--;
- return(wordRange);
-
+ return wordRange;
}
/*
@@ -109,10 +112,8 @@
NSInteger bcnt = 0;
NSInteger scnt = 0;
- NSInteger i;
-
// look for the first non-balanced closing bracket
- for(i=caretPosition; i<stringLength; i++) {
+ for(NSUInteger i=caretPosition; i<stringLength; i++) {
switch([[self string] characterAtIndex:i]) {
case ')':
if(!pcnt) {
@@ -147,7 +148,7 @@
if([[self string] characterAtIndex:caretPosition] == co)
bracketCounter++;
- for(i=caretPosition; i>=0; i--) {
+ for(NSInteger i=caretPosition; i>=0; i--) {
if([[self string] characterAtIndex:i] == co) {
if(!bracketCounter) {
start = i;
@@ -162,7 +163,7 @@
if(start < 0 ) return;
bracketCounter = 0;
- for(i=caretPosition; i<stringLength; i++) {
+ for(NSUInteger i=caretPosition; i<stringLength; i++) {
if([[self string] characterAtIndex:i] == co) {
bracketCounter++;
}
@@ -390,12 +391,12 @@
{
id prefs = [NSUserDefaults standardUserDefaults];
- if([self respondsToSelector:@selector(insertText:)])
- if([prefs objectForKey:SPNullValue] && [[prefs objectForKey:SPNullValue] length])
+ if ([self respondsToSelector:@selector(insertText:)]) {
+ if([prefs stringForKey:SPNullValue] && [[prefs stringForKey:SPNullValue] length])
[self insertText:[prefs objectForKey:SPNullValue]];
else
[self insertText:@"NULL"];
-
+ }
}
/**
@@ -487,7 +488,7 @@
NSInteger idx = [sender tag] - 1000000;
NSString *infoPath = nil;
NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeInputField];
- if(idx >=0 && idx < [bundleItems count]) {
+ if(idx >=0 && idx < (NSInteger)[bundleItems count]) {
infoPath = [[bundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey];
} else {
if([sender tag] == 0 && [[sender toolTip] length]) {
@@ -515,7 +516,7 @@
if (cmdData) [cmdData release];
return;
} else {
- if([cmdData objectForKey:SPBundleFileCommandKey] && [[cmdData objectForKey:SPBundleFileCommandKey] length]) {
+ if([cmdData objectForKey:SPBundleFileCommandKey] && [(NSString *)[cmdData objectForKey:SPBundleFileCommandKey] length]) {
NSString *cmd = [cmdData objectForKey:SPBundleFileCommandKey];
NSString *inputAction = @"";
@@ -647,7 +648,7 @@
[[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil];
NSString *action = SPBundleOutputActionNone;
- if([cmdData objectForKey:SPBundleFileOutputActionKey] && [[cmdData objectForKey:SPBundleFileOutputActionKey] length])
+ if([cmdData objectForKey:SPBundleFileOutputActionKey] && [(NSString *)[cmdData objectForKey:SPBundleFileOutputActionKey] length])
action = [[cmdData objectForKey:SPBundleFileOutputActionKey] lowercaseString];
// Redirect due exit code
@@ -724,7 +725,7 @@
else if([action isEqualToString:SPBundleOutputActionInsertAsSnippet]) {
if([self respondsToSelector:@selector(insertAsSnippet:atRange:)])
- [self insertAsSnippet:output atRange:replaceRange];
+ [(SPTextView *)self insertAsSnippet:output atRange:replaceRange];
else
[SPTooltip showWithObject:NSLocalizedString(@"Input Field doesn't support insertion of snippets.", @"input field doesn't support insertion of snippets.")];
}