From f5570a3b665da74a221af92eec8b11a13fbbdb6e Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 21 Apr 2009 07:17:15 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20-=20(unsigned=20int)=20getLineNumbe?= =?UTF-8?q?rForCharacterIndex:(unsigned=20int)anIndex;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.h | 1 + Source/CMTextView.m | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'Source') 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 @@ -47,6 +47,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. */ -- cgit v1.2.3