mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:19:19 +02:00
SynEdit, Markup-word: Fixed slow reaction to deselected block
git-svn-id: trunk@18218 -
This commit is contained in:
parent
1fbe62ce7f
commit
a38e378eb6
@ -1470,6 +1470,7 @@ begin
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
// needed before setting color
|
||||
fMarkupHighCaret := TSynEditMarkupHighlightAllCaret.Create(self);
|
||||
fMarkupHighCaret.Selection := FBlockSelection;
|
||||
fMarkupHighAll := TSynEditMarkupHighlightAll.Create(self);
|
||||
fMarkupBracket := TSynEditMarkupBracket.Create(self);
|
||||
fMarkupCtrlMouse := TSynEditMarkupCtrlMouseLink.Create(self);
|
||||
|
@ -27,7 +27,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ExtCtrls, SynEditMarkup, SynEditTypes, SynEditSearch,
|
||||
SynEditMiscClasses, Controls, LCLProc, SynEditHighlighter;
|
||||
SynEditMiscClasses, Controls, LCLProc, SynEditHighlighter, SynEditPointClasses;
|
||||
|
||||
type
|
||||
|
||||
@ -135,13 +135,16 @@ type
|
||||
FFullWord: Boolean;
|
||||
FFullWordMaxLen: Integer;
|
||||
FIgnoreKeywords: Boolean;
|
||||
FSelection: TSynEditSelection;
|
||||
FHighlighter: TSynCustomHighlighter;
|
||||
procedure SetFullWord(const AValue: Boolean);
|
||||
procedure SetFullWordMaxLen(const AValue: Integer);
|
||||
procedure SetHighlighter(const AValue: TSynCustomHighlighter);
|
||||
procedure SetIgnoreKeywords(const AValue: Boolean);
|
||||
procedure SetSelection(const AValue: TSynEditSelection);
|
||||
procedure SetWaitTime(const AValue: Integer);
|
||||
protected
|
||||
procedure SelectionChanged(Sender: TObject);
|
||||
procedure DoCaretChanged(OldCaret : TPoint); override;
|
||||
procedure DoTextChanged(StartLine, EndLine : Integer); override;
|
||||
procedure DoMarkupChanged(AMarkup: TSynSelectedColor); override;
|
||||
@ -158,6 +161,7 @@ type
|
||||
property IgnoreKeywords: Boolean read FIgnoreKeywords write SetIgnoreKeywords;
|
||||
property Highlighter: TSynCustomHighlighter
|
||||
read FHighlighter write SetHighlighter;
|
||||
property Selection: TSynEditSelection write SetSelection;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -546,6 +550,14 @@ begin
|
||||
RestartTimer;
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkupHighlightAllCaret.SelectionChanged(Sender: TObject);
|
||||
begin
|
||||
if (SearchString = GetCurrentText) and (SearchOptions = GetCurrentOption) then
|
||||
exit;
|
||||
SearchString := '';
|
||||
RestartTimer;
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkupHighlightAllCaret.SetFullWord(const AValue: Boolean);
|
||||
begin
|
||||
if FFullWord = AValue then exit;
|
||||
@ -574,6 +586,15 @@ begin
|
||||
ScrollTimerHandler(self);
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkupHighlightAllCaret.SetSelection(const AValue: TSynEditSelection);
|
||||
begin
|
||||
if Assigned(FSelection) then
|
||||
FSelection.RemoveChangeHandler({$IFDEF FPC}@{$ENDIF}SelectionChanged);
|
||||
FSelection := AValue;
|
||||
if Assigned(FSelection) then
|
||||
FSelection.AddChangeHandler({$IFDEF FPC}@{$ENDIF}SelectionChanged);
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkupHighlightAllCaret.DoCaretChanged(OldCaret: TPoint);
|
||||
begin
|
||||
if (SearchString = GetCurrentText) and (SearchOptions = GetCurrentOption) then
|
||||
@ -603,6 +624,7 @@ end;
|
||||
|
||||
procedure TSynEditMarkupHighlightAllCaret.ScrollTimerHandler(Sender: TObject);
|
||||
begin
|
||||
FTimer.Enabled := False;
|
||||
if (SearchString = GetCurrentText) and (SearchOptions = GetCurrentOption) then
|
||||
exit;
|
||||
SearchString := ''; // prevent double update
|
||||
@ -649,6 +671,8 @@ end;
|
||||
|
||||
destructor TSynEditMarkupHighlightAllCaret.Destroy;
|
||||
begin
|
||||
if Assigned(FSelection) then
|
||||
FSelection.RemoveChangeHandler({$IFDEF FPC}@{$ENDIF}SelectionChanged);
|
||||
FreeAndNil(FTimer);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
@ -896,6 +896,7 @@ procedure TSynEditSelection.SetSelectionMode(const AValue: TSynSelectionMode);
|
||||
begin
|
||||
FSelectionMode := AValue;
|
||||
SetActiveSelectionMode(AValue);
|
||||
fOnChangeList.CallNotifyEvents(self);
|
||||
end;
|
||||
|
||||
procedure TSynEditSelection.SetActiveSelectionMode(const Value: TSynSelectionMode);
|
||||
|
Loading…
Reference in New Issue
Block a user