codetools: identifier completion: fixed GetLineLength

git-svn-id: trunk@22521 -
This commit is contained in:
mattias 2009-11-10 12:26:48 +00:00
parent d39dca6458
commit 443f653af0
3 changed files with 7 additions and 6 deletions

View File

@ -1582,6 +1582,9 @@ begin
if (StackIndex<Stack.Top) then begin if (StackIndex<Stack.Top) then begin
// block(s) closed by next token // block(s) closed by next token
// use indent of block start // use indent of block start
{$IFDEF VerboseIndenter}
//DebugLn(['TFullyAutomaticBeautifier.GetIndent next token close block: ',FABBlockTypeNames[Stack.TOperation]]);
{$ENDIF}
Indent.Indent:=GetLineIndentWithTabs(Source,Block.StartPos,DefaultTabWidth); Indent.Indent:=GetLineIndentWithTabs(Source,Block.StartPos,DefaultTabWidth);
Indent.IndentValid:=true; Indent.IndentValid:=true;
exit(true); exit(true);

View File

@ -1579,6 +1579,7 @@ begin
GatherContext:=CreateFindContext(Self,CursorNode); GatherContext:=CreateFindContext(Self,CursorNode);
IgnoreCurContext:=false; IgnoreCurContext:=false;
//DebugLn(['TIdentCompletionTool.FindCollectionContext IdentStartPos=',dbgstr(copy(Src,IdentStartPos,20))]);
ContextExprStartPos:=GetContextExprStartPos(IdentStartPos,CursorNode); ContextExprStartPos:=GetContextExprStartPos(IdentStartPos,CursorNode);
if GatherContext.Node.Desc=ctnWithVariable then begin if GatherContext.Node.Desc=ctnWithVariable then begin
if GatherContext.Node.PriorBrother<>nil then if GatherContext.Node.PriorBrother<>nil then

View File

@ -321,12 +321,9 @@ end;
function TSourceLog.GetLineLength(Index: integer): integer; function TSourceLog.GetLineLength(Index: integer): integer;
begin begin
BuildLineRanges; BuildLineRanges;
if (Index>=0) and (Index<fLineCount) then begin if (Index>=0) and (Index<fLineCount) then
if Index<fLineCount-1 then Result:=fLineRanges[Index].EndPos-fLineRanges[Index].StartPos
Result:=fLineRanges[Index+1].EndPos-fLineRanges[Index+1].StartPos else
else
Result:=fSrcLen-fLineRanges[Index].StartPos;
end else
Result:=0; Result:=0;
end; end;