* Reflow code for clarity

This commit is contained in:
Michaël Van Canneyt 2024-07-01 08:32:10 +02:00
parent c2bca23fd1
commit 8cd3e72b36

View File

@ -411,13 +411,21 @@ begin
end; end;
'%': ToAdd:='%'; '%': ToAdd:='%';
end; end;
If (Width<>-1) and (Length(ToAdd)<Width) then // Padding ?
If not Left then If (Width=-1) or (Length(ToAdd)>=Width) then
Result:=Result+TFormatString(Space(Width-Length(ToAdd)))+ToAdd // No width specified or the string to add has required width or greater
Result:=Result+ToAdd
else else
Result:=Result+ToAdd+TFormatString(space(Width-Length(ToAdd))) begin
// String to add is less than requested width. Calc padding string
hs:=TFormatString(space(Width-Length(ToAdd)));
if Left then
// Add left aligned
Result:=Result+ToAdd+hs
else else
Result:=Result+ToAdd; // Add right aligned
Result:=Result+hs+ToAdd;
end;
end; end;
inc(ChPos); inc(ChPos);
Oldpos:=ChPos; Oldpos:=ChPos;