aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-04-21 07:17:15 +0000
committerBibiko <bibiko@eva.mpg.de>2009-04-21 07:17:15 +0000
commitf5570a3b665da74a221af92eec8b11a13fbbdb6e (patch)
tree06db91f267b8373be99080a36fe3031e0ccf4be7
parentd80515ceb26102a1fe06ed0e55e86dcb1778aa0e (diff)
downloadsequelpro-f5570a3b665da74a221af92eec8b11a13fbbdb6e.tar.gz
sequelpro-f5570a3b665da74a221af92eec8b11a13fbbdb6e.tar.bz2
sequelpro-f5570a3b665da74a221af92eec8b11a13fbbdb6e.zip
• added - (unsigned int) getLineNumberForCharacterIndex:(unsigned int)anIndex;
-rw-r--r--Source/CMTextView.h1
-rw-r--r--Source/CMTextView.m8
2 files changed, 9 insertions, 0 deletions
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index dba30ecf..4dee7079 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -53,5 +53,6 @@
- (void) setAutouppercaseKeywords:(BOOL)enableAutouppercaseKeywords;
- (BOOL) autouppercaseKeywords;
- (void) selectLineNumber:(unsigned int)lineNumber ignoreLeadingNewLines:(BOOL)ignLeadingNewLines;
+- (unsigned int) getLineNumberForCharacterIndex:(unsigned int)anIndex;
@end
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index b6bb1229..05df273a 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -48,6 +48,14 @@ YY_BUFFER_STATE yy_scan_string (const char *);
@implementation CMTextView
/*
+ * Returns the associated line number for a character position inside of the CMTextView
+ */
+- (unsigned int) getLineNumberForCharacterIndex:(unsigned int)anIndex
+{
+ return [lineNumberView lineNumberForCharacterIndex:anIndex inText:[self string]]+1;
+}
+
+/*
* Add a menu item to context menu for looking up mysql documentation.
*/
- (NSMenu *)menuForEvent:(NSEvent *)event