From 7fe0a34e7b68c31967e02e47885dbe579fb45e30 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 19 Mar 2011 17:00:28 +0000 Subject: [PATCH] win32: Adjust line breaks before assigning a text string to memo (issue #0017000) git-svn-id: trunk@29915 - --- lcl/interfaces/win32/win32memostrings.inc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/win32/win32memostrings.inc b/lcl/interfaces/win32/win32memostrings.inc index 238f4d4109..7c8ab6f1e9 100644 --- a/lcl/interfaces/win32/win32memostrings.inc +++ b/lcl/interfaces/win32/win32memostrings.inc @@ -205,15 +205,17 @@ end; procedure TWin32MemoStrings.SetTextStr(const Value: string); var Msg: TLMessage; + AdjustedValue: String; begin - if (Value <> Text) then + AdjustedValue := AdjustLineBreaks(Value); + if (AdjustedValue <> Text) then begin {$ifdef WindowsUnicodeSupport} if UnicodeEnabledOS - then Windows.SetWindowTextW(FHandle, PWideChar(UTF8ToUTF16(Value))) - else Windows.SetWindowText(FHandle, PChar(Utf8ToAnsi(Value))); + then Windows.SetWindowTextW(FHandle, PWideChar(UTF8ToUTF16(AdjustedValue))) + else Windows.SetWindowText(FHandle, PChar(Utf8ToAnsi(AdjustedValue))); {$else} - SendMessage(FHandle, WM_SETTEXT, 0, LPARAM(PChar(Value))); + SendMessage(FHandle, WM_SETTEXT, 0, LPARAM(PChar(AdjustedValue))); {$endif} FillChar(Msg, SizeOf(Msg), 0); Msg.Msg := CM_TEXTCHANGED;