mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-14 16:32:48 +02:00
SynEdit: improved handling of Lines.Add while updating(locked) // fixed some Indent issues
git-svn-id: trunk@25707 -
This commit is contained in:
parent
db05dbd916
commit
5d28e4d998
@ -5753,6 +5753,7 @@ begin
|
||||
DoOnCommandProcessed(Command, AChar, Data);
|
||||
|
||||
if assigned(FBeautifier) then begin
|
||||
tsyneditstringlist(FLines).FlushNotificationCache;
|
||||
FBeautifier.AutoIndent := (eoAutoIndent in FOptions);
|
||||
FBeautifier.AfterCommand(self, FTheLinesView, FCaret, Command, InitialCmd,
|
||||
FBeautifyStartLineIdx+1, FBeautifyEndLineIdx+1);
|
||||
|
@ -196,6 +196,7 @@ type
|
||||
aTxt: String = ''); virtual; abstract;
|
||||
procedure SendNotification(AReason: TSynEditNotifyReason;
|
||||
ASender: TObject); virtual; abstract;
|
||||
procedure FlushNotificationCache; virtual; abstract;
|
||||
public
|
||||
function GetPhysicalCharWidths(Index: Integer): TPhysicalCharWidths;
|
||||
function GetPhysicalCharWidths(const Line: String; Index: Integer): TPhysicalCharWidths; virtual; abstract;
|
||||
@ -290,6 +291,7 @@ type
|
||||
aTxt: String = ''); override;
|
||||
procedure SendNotification(AReason: TSynEditNotifyReason;
|
||||
ASender: TObject); override;
|
||||
procedure FlushNotificationCache; override;
|
||||
|
||||
function GetPhysicalCharWidths(const Line: String; Index: Integer): TPhysicalCharWidths; override;
|
||||
property NextLines: TSynEditStrings read fSynStrings write fSynStrings;
|
||||
@ -858,6 +860,11 @@ begin
|
||||
fSynStrings.SendNotification(AReason, ASender);
|
||||
end;
|
||||
|
||||
procedure TSynEditStringsLinked.FlushNotificationCache;
|
||||
begin
|
||||
fSynStrings.FlushNotificationCache;
|
||||
end;
|
||||
|
||||
procedure TSynEditStringsLinked.IgnoreSendNotification(AReason: TSynEditNotifyReason;
|
||||
IncIgnore: Boolean);
|
||||
begin
|
||||
|
@ -206,6 +206,7 @@ type
|
||||
aBytePos: Integer = -1; aLen: Integer = 0; aTxt: String = ''); override;
|
||||
procedure SendNotification(AReason: TSynEditNotifyReason;
|
||||
ASender: TObject); override;
|
||||
procedure FlushNotificationCache; override;
|
||||
function GetPhysicalCharWidths(const Line: String; Index: Integer): TPhysicalCharWidths; override;
|
||||
// For Textbuffersharing
|
||||
procedure AttachSynEdit(AEdit: TSynEditBase);
|
||||
@ -562,8 +563,8 @@ begin
|
||||
BeginUpdate;
|
||||
SetCount(0);
|
||||
SetCapacity(0);
|
||||
SendNotification(senrCleared, Self);
|
||||
SendNotification(senrLineCount, self, 0, -c);
|
||||
SendNotification(senrCleared, Self);
|
||||
EndUpdate;
|
||||
end;
|
||||
fIndexOfLongestLine := -1;
|
||||
@ -965,8 +966,10 @@ end;
|
||||
|
||||
procedure TSynEditStringList.SendCachedNotify;
|
||||
begin
|
||||
TLineRangeNotificationList(FNotifyLists[senrLineCount])
|
||||
.CallRangeNotifyEvents(FCachedNotifySender, FCachedNotifyStart, FCachedNotifyCount);
|
||||
//debugln(['--- send canched notify ', FCachedNotifyStart,' / ',FCachedNotifyCount]);
|
||||
if FCachedNotifyCount <> 0 then;
|
||||
TLineRangeNotificationList(FNotifyLists[senrLineCount])
|
||||
.CallRangeNotifyEvents(FCachedNotifySender, FCachedNotifyStart, FCachedNotifyCount);
|
||||
FCachedNotify := False;
|
||||
end;
|
||||
|
||||
@ -1165,10 +1168,13 @@ begin
|
||||
end
|
||||
else
|
||||
if (FCachedNotifySender = ASender) and (aIndex >= FCachedNotifyStart) and
|
||||
(FCachedNotifyCount > 0) and
|
||||
(aIndex <= FCachedNotifyStart + FCachedNotifyCount) and
|
||||
((aCount > 0) or (aIndex - aCount < FCachedNotifyStart + FCachedNotifyCount))
|
||||
((aCount > 0) or (aIndex - aCount <= FCachedNotifyStart + FCachedNotifyCount))
|
||||
then begin
|
||||
FCachedNotifyCount := FCachedNotifyCount + aCount;
|
||||
if FCachedNotifyCount = 0 then
|
||||
FCachedNotify := False;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
@ -1206,6 +1212,12 @@ begin
|
||||
FNotifyLists[AReason].CallNotifyEvents(ASender);
|
||||
end;
|
||||
|
||||
procedure TSynEditStringList.FlushNotificationCache;
|
||||
begin
|
||||
if FCachedNotify then
|
||||
SendCachedNotify;
|
||||
end;
|
||||
|
||||
procedure TSynEditStringList.IgnoreSendNotification(AReason: TSynEditNotifyReason;
|
||||
IncIgnore: Boolean);
|
||||
begin
|
||||
|
@ -606,6 +606,7 @@ end;
|
||||
|
||||
procedure TSynEditStringTrimmingList.ForceTrim;
|
||||
begin
|
||||
FlushNotificationCache;
|
||||
DoCaretChanged(fCaret); // Caret May be locked
|
||||
TrimAfterLock;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user