From cf53186c8e4940904ede9497a37e8c32cffed4d1 Mon Sep 17 00:00:00 2001 From: rich2014 Date: Wed, 1 May 2024 15:23:54 +0800 Subject: [PATCH] Cocoa: Fix #40937 the linefeed issue in TCocoaMemoStrings (patch by David Jenkins) --- lcl/interfaces/cocoa/cocoawsstdctrls.pas | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lcl/interfaces/cocoa/cocoawsstdctrls.pas b/lcl/interfaces/cocoa/cocoawsstdctrls.pas index c311d87d14..f591ea41bc 100644 --- a/lcl/interfaces/cocoa/cocoawsstdctrls.pas +++ b/lcl/interfaces/cocoa/cocoawsstdctrls.pas @@ -203,6 +203,7 @@ type function Get(Index: Integer): string; override; public constructor Create(ATextView: TCocoaTextView); + procedure Assign(Source: TPersistent); override; procedure Clear; override; procedure Delete(Index: Integer); override; procedure Insert(Index: Integer; const S: string); override; @@ -1433,6 +1434,16 @@ begin SetTextStr(''); end; +procedure TCocoaMemoStrings.Assign(Source: TPersistent); +begin + if (Source=Self) or (Source=nil) then + exit; + if Source is TStrings then + SetTextStr(TStrings(Source).Text) + else + inherited Assign(Source); +end; + procedure TCocoaMemoStrings.Delete(Index:Integer); var s : AnsiString;