From 8cd3e72b3668e51e9e1357199f254a2c6aaf31b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Mon, 1 Jul 2024 08:32:10 +0200 Subject: [PATCH] * Reflow code for clarity --- rtl/objpas/sysutils/sysformt.inc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/rtl/objpas/sysutils/sysformt.inc b/rtl/objpas/sysutils/sysformt.inc index b892278b1b..0e1623fc12 100644 --- a/rtl/objpas/sysutils/sysformt.inc +++ b/rtl/objpas/sysutils/sysformt.inc @@ -411,13 +411,21 @@ begin end; '%': ToAdd:='%'; end; - If (Width<>-1) and (Length(ToAdd)=Width) then + // No width specified or the string to add has required width or greater + Result:=Result+ToAdd else - Result:=Result+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 + // Add right aligned + Result:=Result+hs+ToAdd; + end; end; inc(ChPos); Oldpos:=ChPos;