- labels: 694450 -->
property TSynEditStringList.AppendNewLineAtEOF
work with streams, but doesn't work with DB fields,
which used Text property. To correct it i'v to do:
in unit SynEditTextBuffer, in protected part of class
TSynEditStringList insert this declaration:
-------- begin code ------------------------------------
// <<-- IC Nashev: to use AppendNewLineAtEOF
in value of Text property
function GetTextStr: string; override;
procedure SetTextStr(const Value: string);
override;
// -->> IC Nashev
-------- end code --------------------------------------
in unit SynEditTextBuffer implementation insert this:
-------- begin code ------------------------------------
// <<-- IC Nashev: to use AppendNewLineAtEOF in
value of Text property
function TSynEditStringList.GetTextStr: string;
begin
Result := inherited GetTextStr;
if not AppendNewLineAtEOF then SetLength(Result,
Length(Result)-Length(sLineBreak));
end;
procedure TSynEditStringList.SetTextStr(const Value:
string);
var
P, Start: PChar;
S: string;
begin
// Addition to TStrings.SetTextStr code, to prevent
call
// Changed and Cleared in case of setting existing
text:
if Text = Value then Exit;
BeginUpdate;
try
Clear;
P := Pointer(Value);
if P <> nil then
while P^ <> #0 do
begin
Start := P;
while not (P^ in [#0, #10, #13]) do Inc(P);
SetString(S, Start, P - Start);
Add(S);
// addition to original TStrings.SetTextStr code
to save last empty line if that exists:
if (P^ <> #0) then begin
if P^ = #13 then Inc(P);
if P^ = #10 then Inc(P);
if (P^ = #0) and not AppendNewLineAtEOF
then Add('');
end;
end;
finally
EndUpdate;
end;
end;
// -->> IC Nashev
-------- end code --------------------------------------