From 750e490411aebc2e81ded904544544c814852b55 Mon Sep 17 00:00:00 2001 From: Martijn Laan <1092369+martijnlaan@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:42:58 +0200 Subject: [PATCH 1/2] Cleanup. --- Components/ScintEdit.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Components/ScintEdit.pas b/Components/ScintEdit.pas index 98ddd1fe4..ca8b1e07c 100644 --- a/Components/ScintEdit.pas +++ b/Components/ScintEdit.pas @@ -335,7 +335,7 @@ TScintEdit = class(TWinControl) write SetAutoCompleteFontName; property AutoCompleteFontSize: Integer read FAutoCompleteFontSize write SetAutoCompleteFontSize default 0; - property ChangeHistory: Boolean read FChangeHistory write SetChangeHistory; + property ChangeHistory: Boolean read FChangeHistory write SetChangeHistory default False; property CodePage: Integer read FCodePage write SetCodePage default CP_UTF8; property Color; property FillSelectionToEdge: Boolean read FFillSelectionToEdge write SetFillSelectionToEdge From 359ac3f5821376eff3446ef71c64fd2a33cceedb Mon Sep 17 00:00:00 2001 From: Martijn Laan <1092369+martijnlaan@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:50:38 +0200 Subject: [PATCH 2/2] Clarify. --- Components/ScintEdit.pas | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Components/ScintEdit.pas b/Components/ScintEdit.pas index ca8b1e07c..86ff2f8df 100644 --- a/Components/ScintEdit.pas +++ b/Components/ScintEdit.pas @@ -1289,14 +1289,13 @@ function TScintEdit.ReplaceTextRange(const StartPos, EndPos: Integer; end; procedure TScintEdit.RestyleLine(const Line: Integer); -var - StartPos, EndPos, EndStyledPos: Integer; begin - StartPos := GetPositionFromLine(Line); - EndPos := GetPositionFromLine(Line + 1); - { Back up the 'last styled position' if necessary } - EndStyledPos := Call(SCI_GETENDSTYLED, 0, 0); - if StartPos < EndStyledPos then + var StartPos := GetPositionFromLine(Line); + var EndPos := GetPositionFromLine(Line + 1); + { Back up the 'last styled position' if necessary using SCI_STARTSTYLINE + (SCI_SETENDSTYLED would have been a clearer name because setting the + 'last styled position' is all it does) } + if StartPos < Call(SCI_GETENDSTYLED, 0, 0) then Call(SCI_STARTSTYLING, StartPos, 0); StyleNeeded(EndPos); end;