From 862a431ebf1571f09890f43702e50fdc43b13415 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 28 Jan 2010 17:04:04 +0000 Subject: =?UTF-8?q?=E2=80=A2=20for=20[CMTextView=20selectLineNumber:?= =?UTF-8?q?=E2=80=A6]=20added=20safety-check=20for=20lineNumber=20<=201=20?= =?UTF-8?q?=E2=80=A2=20error=20message=20highlighting=20in=20CustomQuery?= =?UTF-8?q?=20-=20check=20for=20error=20ID=201064=20before=20trying=20to?= =?UTF-8?q?=20select=20the=20erroneous=20line=20given=20as=20'=E2=80=A6=20?= =?UTF-8?q?at=20line=20x'=20(this=20solves=20the=20issue=20that=20other=20?= =?UTF-8?q?error=20messages=20could=20end=20by=20a=20number)=20-=20improve?= =?UTF-8?q?d=20regexp=20to=20get=20rid=20of=20localized=20error=20messages?= =?UTF-8?q?=20for=20parsing=20the=20erroneous=20line=20number=20(thanks=20?= =?UTF-8?q?to=20Jakob)=20-=20look=20the=20last=20number=20in=20a=20string?= =?UTF-8?q?=20-=20improved=20regexp=20to=20parse=20for=20the=20'near=20mes?= =?UTF-8?q?sage'=20for=20localized=20error=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 3 ++- Source/CustomQuery.m | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 1d75eb93..6bd6f315 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -760,9 +760,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) lineNumber++; } } - + // Safety-check the line number if (lineNumber > [lineRanges count]) lineNumber = [lineRanges count]; + if (lineNumber < 1) lineNumber = 1; // Grab the range to select selRange = NSRangeFromString([lineRanges objectAtIndex:lineNumber-1]); diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 6f8afecf..45f177a3 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -691,9 +691,13 @@ if ( [mySQLConnection queryCancelled] || ([errors length] && !queryIsTableSorter)) { // set the error text [errorText setStringValue:errors]; - // select the line x of the first error if error message contains "at line x" - NSRange errorLineNumberRange = [errors rangeOfRegex:@"(?