mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 22:58:18 +02:00
Qt5: fixed behaviour of TMemo.Lines.Add(), still slower than gtk or win32, but have correct behaviour when last line of memo is line break. For faster inserts remove last line break. issue #39444
This commit is contained in:
parent
38f4119540
commit
6a197ad3ca
@ -437,11 +437,22 @@ begin
|
|||||||
// simplified because of issue #29670
|
// simplified because of issue #29670
|
||||||
// allow insert invalid index like others do
|
// allow insert invalid index like others do
|
||||||
if Index >= FStringList.Count then
|
if Index >= FStringList.Count then
|
||||||
Index := FStringList.Add(S)
|
begin
|
||||||
else
|
Index := FStringList.Add(S);
|
||||||
|
if FHasTrailingLineBreak then
|
||||||
|
W := GetUTF8String(S + LineBreak)
|
||||||
|
else
|
||||||
|
W := GetUTF8String(S);
|
||||||
|
if FHasTrailingLineBreak then
|
||||||
|
TQtTextEdit(FOwner.Handle).setLineText(Index, W)
|
||||||
|
else
|
||||||
|
TQtTextEdit(FOwner.Handle).Append(W);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
FStringList.Insert(Index, S);
|
FStringList.Insert(Index, S);
|
||||||
W := GetUTF8String(S);
|
W := GetUTF8String(S);
|
||||||
TQtTextEdit(FOwner.Handle).insertLine(Index, W);
|
TQtTextEdit(FOwner.Handle).insertLine(Index, W);
|
||||||
|
end;
|
||||||
FTextChanged := False; // FStringList is already updated, no need to update from WS.
|
FTextChanged := False; // FStringList is already updated, no need to update from WS.
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user