Cocoa: Fix #40937 the linefeed issue in TCocoaMemoStrings (patch by David Jenkins)

This commit is contained in:
rich2014 2024-05-01 15:23:54 +08:00
parent a3cc94cfff
commit cf53186c8e

View File

@ -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;