codetools: FindStartOfAtom check if at start of string constant, bug #16203

git-svn-id: trunk@24446 -
This commit is contained in:
mattias 2010-04-05 20:02:16 +00:00
parent fda361abd7
commit 314c61457e
3 changed files with 16 additions and 4 deletions

View File

@ -2034,16 +2034,22 @@ end;
function FindStartOfAtom(const Source: string; Position: integer): integer;
procedure ReadStringConstantBackward(var p: integer);
var PrePos: integer;
var
PrePos: integer;
begin
while (p>1) do begin
case Source[p-1] of
'''':
begin
dec(p);
PrePos:=p;
dec(PrePos);
repeat
dec(p);
until (p<1) or (Source[p]='''');
dec(PrePos);
if (PrePos<1) or (Source[PrePos] in [#10,#13]) then begin
exit;
end;
until (Source[PrePos]='''');
p:=PrePos;
end;
'0'..'9','A'..'Z','a'..'z':
begin
@ -2086,6 +2092,7 @@ begin
Result:=length(Source);
exit;
end;
c:=Source[Result];
case c of
'_','A'..'Z','a'..'z':

View File

@ -1567,6 +1567,7 @@ begin
FillByte(Indent,SizeOf(Indent),0);
CleanPos:=FindStartOfAtom(Source,CleanPos);
DebugLn(['TFullyAutomaticBeautifier.GetIndent ']);
if CleanPos<1 then exit;
if UseLineStart and (InsertText='') then begin

View File

@ -517,7 +517,9 @@ begin
inc(PreferredHeight, (Adjusted.Top - ARect.Top) + (ARect.Bottom - Adjusted.Bottom));
{$ENDIF}
{$IFNDEF OldAutoSize}
FixedWidth:=false;
{$ENDIF}
if [akLeft,akRight]*Anchors=[akLeft,akRight] then begin
// the width depends on the parent or siblings
// use a simpe heuristic to find out if the width is fixed
@ -526,7 +528,9 @@ begin
and (Parent.AutoSize=false)
then begin
// the width is fixed
{$IFNDEF OldAutoSize}
FixedWidth:=true;
{$ENDIF}
WrapButtons(Width, NewWidth, NewHeight, True);
PreferredWidth := NewWidth;
PreferredHeight := NewHeight;