mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 13:20:23 +02:00
SynEdit: Fixed LineOverviewGutter for new shared marks code
git-svn-id: trunk@27913 -
This commit is contained in:
parent
1cd4b77593
commit
7af59a81a6
@ -5262,6 +5262,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
TempPlugins: TList;
|
TempPlugins: TList;
|
||||||
begin
|
begin
|
||||||
|
FLines.SendNotification(senrTextBufferChanging, FLines); // Send the old buffer
|
||||||
DestroyMarkList;
|
DestroyMarkList;
|
||||||
|
|
||||||
// Remember all Plugins; Detach from Lines
|
// Remember all Plugins; Detach from Lines
|
||||||
|
@ -54,6 +54,7 @@ type
|
|||||||
senrDecPaintLock,
|
senrDecPaintLock,
|
||||||
senrAfterIncPaintLock, // For plugins, etc...
|
senrAfterIncPaintLock, // For plugins, etc...
|
||||||
senrBeforeDecPaintLock,
|
senrBeforeDecPaintLock,
|
||||||
|
senrTextBufferChanging, // About to change
|
||||||
senrTextBufferChanged
|
senrTextBufferChanged
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -250,6 +250,8 @@ type
|
|||||||
procedure DoMarkChange(Sender: TSynEditMark; Changes: TSynEditMarkChangeReasons);
|
procedure DoMarkChange(Sender: TSynEditMark; Changes: TSynEditMarkChangeReasons);
|
||||||
function CreateGutterMark(ASynMark: TSynEditMark): TSynGutterLOvMark;
|
function CreateGutterMark(ASynMark: TSynEditMark): TSynGutterLOvMark;
|
||||||
function IndexOfSynMark(ASynMark: TSynEditMark): Integer;
|
function IndexOfSynMark(ASynMark: TSynEditMark): Integer;
|
||||||
|
procedure BufferChanging(Sender: TObject);
|
||||||
|
procedure BufferChanged(Sender: TObject);
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -1146,17 +1148,47 @@ begin
|
|||||||
while Result >= 0 do begin;
|
while Result >= 0 do begin;
|
||||||
if FMarkList[Result].FData = Pointer(ASynMark) then exit;
|
if FMarkList[Result].FData = Pointer(ASynMark) then exit;
|
||||||
dec(Result);
|
dec(Result);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSynGutterLOvProviderBookmarks.BufferChanging(Sender: TObject);
|
||||||
|
begin
|
||||||
|
TSynEdit(SynEdit).Marks.UnRegisterChangeHandler({$IFDEF FPC}@{$ENDIF}DoMarkChange);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynGutterLOvProviderBookmarks.BufferChanged(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
TSynEditStringList(Sender).RemoveHanlders(self);
|
||||||
|
TSynEditStringList(TextBuffer).AddGenericHandler(senrTextBufferChanging, TMethod({$IFDEF FPC}@{$ENDIF}BufferChanging));
|
||||||
|
TSynEditStringList(TextBuffer).AddGenericHandler(senrTextBufferChanged, TMethod({$IFDEF FPC}@{$ENDIF}BufferChanged));
|
||||||
|
TSynEdit(SynEdit).Marks.RegisterChangeHandler({$IFDEF FPC}@{$ENDIF}DoMarkChange,
|
||||||
|
[smcrAdded, smcrRemoved, smcrLine, smcrVisible, smcrChanged]);
|
||||||
|
|
||||||
|
while FMarkList.Count > 0 do begin
|
||||||
|
FMarkList[0].Destroy;
|
||||||
|
FMarkList.Delete(0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
for i := 0 to TSynEdit(SynEdit).Marks.Count - 1 do
|
||||||
|
if TSynEdit(SynEdit).Marks[i].Visible then
|
||||||
|
CreateGutterMark(TSynEdit(SynEdit).Marks[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TSynGutterLOvProviderBookmarks.Create(AOwner: TComponent);
|
constructor TSynGutterLOvProviderBookmarks.Create(AOwner: TComponent);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
Color := clBlue;
|
Color := clBlue;
|
||||||
|
TSynEditStringList(TextBuffer).AddGenericHandler(senrTextBufferChanging, TMethod({$IFDEF FPC}@{$ENDIF}BufferChanging));
|
||||||
|
TSynEditStringList(TextBuffer).AddGenericHandler(senrTextBufferChanged, TMethod({$IFDEF FPC}@{$ENDIF}BufferChanged));
|
||||||
|
|
||||||
TSynEdit(SynEdit).Marks.RegisterChangeHandler({$IFDEF FPC}@{$ENDIF}DoMarkChange,
|
TSynEdit(SynEdit).Marks.RegisterChangeHandler({$IFDEF FPC}@{$ENDIF}DoMarkChange,
|
||||||
[smcrAdded, smcrRemoved, smcrLine, smcrVisible, smcrChanged]);
|
[smcrAdded, smcrRemoved, smcrLine, smcrVisible, smcrChanged]);
|
||||||
|
|
||||||
for i := 0 to TSynEdit(SynEdit).Marks.Count - 1 do
|
for i := 0 to TSynEdit(SynEdit).Marks.Count - 1 do
|
||||||
if TSynEdit(SynEdit).Marks[i].Visible then
|
if TSynEdit(SynEdit).Marks[i].Visible then
|
||||||
CreateGutterMark(TSynEdit(SynEdit).Marks[i]);
|
CreateGutterMark(TSynEdit(SynEdit).Marks[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user