mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-06 17:00:32 +01:00
SynEdit: speed up large operations (search replace) / fix
git-svn-id: trunk@43764 -
This commit is contained in:
parent
d57a4a302e
commit
626258734f
@ -196,6 +196,7 @@ type
|
||||
procedure Put(Index: integer; const S: string); override;
|
||||
procedure PutObject(Index: integer; AObject: TObject); override;
|
||||
procedure SetCapacity(NewCapacity: integer); override;
|
||||
procedure MaybeSendSenrLinesModified; inline;
|
||||
procedure SetUpdateState(Updating: Boolean; Sender: TObject); override;
|
||||
|
||||
procedure UndoEditLinesDelete(LogY, ACount: Integer);
|
||||
@ -1218,6 +1219,14 @@ begin
|
||||
IncreaseTextChangeStamp;
|
||||
end;
|
||||
|
||||
procedure TSynEditStringList.MaybeSendSenrLinesModified;
|
||||
begin
|
||||
assert( (FModifiedNotifyOldCount >= 0) and (FModifiedNotifyNewCount >= 0), 'FModifiedNotify___Count >= 0');
|
||||
if (FModifiedNotifyOldCount > 0) or (FModifiedNotifyNewCount > 0) then
|
||||
TLinesModifiedNotificationList(FNotifyLists[senrLinesModified])
|
||||
.CallRangeNotifyEvents(Self, FModifiedNotifyStart, FModifiedNotifyNewCount, FModifiedNotifyOldCount);
|
||||
end;
|
||||
|
||||
procedure TSynEditStringList.SetUpdateState(Updating: Boolean; Sender: TObject);
|
||||
begin
|
||||
if FIsInDecPaintLock then exit;
|
||||
@ -1231,11 +1240,7 @@ begin
|
||||
end else begin
|
||||
if FCachedNotify then
|
||||
SendCachedNotify;
|
||||
assert( (FModifiedNotifyOldCount >= 0) and (FModifiedNotifyNewCount >= 0), 'FModifiedNotify___Count >= 0');
|
||||
if (FModifiedNotifyOldCount > 0) or (FModifiedNotifyNewCount > 0) then
|
||||
TLinesModifiedNotificationList(FNotifyLists[senrLinesModified])
|
||||
.CallRangeNotifyEvents(Self, FModifiedNotifyStart, FModifiedNotifyNewCount, FModifiedNotifyOldCount);
|
||||
// Above notifications must be before senrDecPaintLock is sent
|
||||
MaybeSendSenrLinesModified; // must be before senrDecPaintLock is sent
|
||||
FIsInDecPaintLock := True;
|
||||
try
|
||||
SendNotification(senrBeforeDecPaintLock, Sender);
|
||||
@ -1527,10 +1532,12 @@ end;
|
||||
procedure TSynEditStringList.SendNotification(AReason: TSynEditNotifyReason;
|
||||
ASender: TObject);
|
||||
begin
|
||||
if FCachedNotify then
|
||||
SendCachedNotify;
|
||||
if AReason in [senrLineChange, senrLineCount, senrLinesModified, senrHighlightChanged, senrEditAction] then
|
||||
raise Exception.Create('Invalid');
|
||||
if FCachedNotify then
|
||||
SendCachedNotify;
|
||||
if (AReason in [senrCleared, senrTextBufferChanging]) then
|
||||
MaybeSendSenrLinesModified;
|
||||
FNotifyLists[AReason].CallNotifyEvents(ASender);
|
||||
end;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user