aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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