codetools: fixed FindLineEndOrCodeInFrontOfPosition to return the start of the line end, bug #16519

git-svn-id: trunk@25526 -
This commit is contained in:
mattias 2010-05-20 08:03:53 +00:00
parent 1624eca2ae
commit 0e3f868fb4
3 changed files with 4 additions and 11 deletions

View File

@ -2519,7 +2519,7 @@ begin
if (Result>SrcStart) and (Source[Result-1] in [#10,#13])
and (Source[Result]<>Source[Result-1]) then
dec(Result);
LineEndPos:=Result+1;
LineEndPos:=Result; // start of line end
// test if in a // comment
LineStartPos:=Result;
IsEmpty:=true;
@ -2532,7 +2532,7 @@ begin
dec(LineStartPos);
end;
if IsEmpty then begin
// the line is empty
// the line is empty => return start of line end
Result:=LineEndPos;
exit;
end;

View File

@ -212,9 +212,8 @@ type
out ALineStart, ALineEnd, AFirstAtomStart, ALastAtomEnd: integer);
function FindLineEndOrCodeAfterPosition(StartPos: integer;
SkipEmptyLines: boolean = false; IncludeLineEnd: boolean = false): integer;
function FindLineEndOrCodeInFrontOfPosition(StartPos: integer): integer;
function FindLineEndOrCodeInFrontOfPosition(StartPos: integer;
StopAtDirectives: boolean): integer;
StopAtDirectives: boolean = true): integer;
function UpdateNeeded(OnlyInterfaceNeeded: boolean): boolean;
procedure BeginParsing(DeleteNodes, OnlyInterfaceNeeded: boolean); virtual;
@ -2449,12 +2448,6 @@ begin
Result:=StartPos;
end;
function TCustomCodeTool.FindLineEndOrCodeInFrontOfPosition(StartPos: integer
): integer;
begin
Result:=FindLineEndOrCodeInFrontOfPosition(StartPos,true);
end;
function TCustomCodeTool.FindLineEndOrCodeInFrontOfPosition(StartPos: integer;
StopAtDirectives: boolean): integer;
{ Searches a nice position in the cleaned source in front of StartPos.

View File

@ -2094,7 +2094,7 @@ var
i: Integer;
begin
{$IFDEF IDE_DEBUG}
writeln('[TSourceEditor.OnCodeBufferChanged] A ',FIgnoreCodeBufferLock,' ',SrcLogEntry<>nil);
debugln(['[TSourceEditor.OnCodeBufferChanged] A ',FIgnoreCodeBufferLock,' ',SrcLogEntry<>nil]);
{$ENDIF}
if FIgnoreCodeBufferLock>0 then exit;
CodeToolsInSync:=not NeedsUpdateCodeBuffer;