From 4809be32c6d303c62a0c57f38ec0270669cd20dc Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 7 May 2010 11:04:50 +0000 Subject: [PATCH] codetools: fixed FindCOdeOrLineEndInFrontOf for bracket close, bug #16419 git-svn-id: trunk@25238 - --- components/codetools/basiccodetools.pas | 11 +++++++++-- components/codetools/stdcodetools.pas | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index 92beac376e..e6d8940ca7 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -2464,8 +2464,12 @@ var SrcStart: integer; Result:=not (StopAtDirectives and (P>=SrcStart) and (Source[P+1]='$')); dec(P,2); - end else - Result:=true; + end else begin + // normal bracket + // => position behind code + inc(p); + Result:=false; + end; end; else Result:=true; @@ -2477,6 +2481,7 @@ var TestPos: integer; LineStartPos: LongInt; IsEmpty: Boolean; + LineEndPos: Integer; begin SrcStart:=MinPosition; if SrcStart<1 then SrcStart:=1; @@ -2499,6 +2504,7 @@ begin if (Result>SrcStart) and (Source[Result-1] in [#10,#13]) and (Source[Result]<>Source[Result-1]) then dec(Result); + LineEndPos:=Result+1; // test if in a // comment LineStartPos:=Result; IsEmpty:=true; @@ -2512,6 +2518,7 @@ begin end; if IsEmpty then begin // the line is empty + Result:=LineEndPos; exit; end; TestPos:=LineStartPos; diff --git a/components/codetools/stdcodetools.pas b/components/codetools/stdcodetools.pas index d55e831f35..0a282938ce 100644 --- a/components/codetools/stdcodetools.pas +++ b/components/codetools/stdcodetools.pas @@ -4748,6 +4748,7 @@ begin // -> delete whole line FromPos:=FindLineEndOrCodeInFrontOfPosition(VarNode.StartPos); ToPos:=FindLineEndOrCodeAfterPosition(VarNode.EndPos); + //debugln(['TStandardCodeTool.RemovePublishedVariable ',dbgstr(copy(Src,FromPos,ToPos-FromPos))]); end else begin // variable definition has the form 'VarName, NextVarName: VarType;' // -> delete only 'VarName, '