From 3bb3ac5dff74e0476bf8ab6421c2459eba8d8eb9 Mon Sep 17 00:00:00 2001 From: maxim Date: Sat, 16 Jul 2016 10:22:01 +0000 Subject: [PATCH] LCL, Translations unit: Improved lieending removal code clarity, added more comments. git-svn-id: trunk@52700 - --- lcl/translations.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lcl/translations.pas b/lcl/translations.pas index 82c4bb4009..b342456547 100644 --- a/lcl/translations.pas +++ b/lcl/translations.pas @@ -1168,14 +1168,18 @@ begin end else Result:=OriginalValue; //Remove lineending at the end of the string if present. - //This is the case e.g. for multiline string and not desired when assigning e.g. to + //This is the case e.g. for multiline strings and not desired when assigning e.g. to //Caption property (can negatively affect form layout). In other cases it should not matter. l:=Length(Result); if l>1 then begin + //Every string with #13 and/or #10 character at the end was treated as multiline, this means that + //extra lineending could have been added to it. if RightStr(Result,2)=#13#10 then + begin if l>2 then //do not leave the string empty - SetLength(Result,l-2) + SetLength(Result,l-2); + end else if (Result[l]=#13) or (Result[l]=#10) then SetLength(Result,l-1);