mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-17 00:40:54 +01:00
SynEdit: Fixed marklist handling
git-svn-id: trunk@27822 -
This commit is contained in:
parent
b22fb772ba
commit
51c547b656
@ -1957,7 +1957,7 @@ begin
|
|||||||
fPlugins:=nil;
|
fPlugins:=nil;
|
||||||
FCaret.Lines := nil;
|
FCaret.Lines := nil;
|
||||||
FInternalCaret.Lines := nil;
|
FInternalCaret.Lines := nil;
|
||||||
DestroyMarkList;
|
FMarkList.UnRegisterChangeHandler({$IFDEF FPC}@{$ENDIF}MarkListChange);
|
||||||
FreeAndNil(fTSearch);
|
FreeAndNil(fTSearch);
|
||||||
FreeAndNil(fMarkupManager);
|
FreeAndNil(fMarkupManager);
|
||||||
FreeAndNil(fBookMarkOpt);
|
FreeAndNil(fBookMarkOpt);
|
||||||
@ -1972,6 +1972,7 @@ begin
|
|||||||
FreeAndNil(FPaintLineColor2);
|
FreeAndNil(FPaintLineColor2);
|
||||||
FreeAndNil(fTextDrawer);
|
FreeAndNil(fTextDrawer);
|
||||||
FreeAndNil(fFontDummy);
|
FreeAndNil(fFontDummy);
|
||||||
|
DestroyMarkList;
|
||||||
FreeAndNil(FWordBreaker);
|
FreeAndNil(FWordBreaker);
|
||||||
FreeAndNil(FFoldedLinesView); // has reference to caret
|
FreeAndNil(FFoldedLinesView); // has reference to caret
|
||||||
FreeAndNil(FInternalBlockSelection);
|
FreeAndNil(FInternalBlockSelection);
|
||||||
@ -5225,6 +5226,8 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
TempPlugins: TList;
|
TempPlugins: TList;
|
||||||
begin
|
begin
|
||||||
|
DestroyMarkList;
|
||||||
|
|
||||||
// Remember all Plugins; Detach from Lines
|
// Remember all Plugins; Detach from Lines
|
||||||
TempPlugins := TList.Create;
|
TempPlugins := TList.Create;
|
||||||
for i := FPlugins.Count - 1 downto 0 do begin
|
for i := FPlugins.Count - 1 downto 0 do begin
|
||||||
@ -5237,7 +5240,9 @@ begin
|
|||||||
|
|
||||||
// Set the New Lines
|
// Set the New Lines
|
||||||
OldBuffer := TSynEditStringList(FLines);
|
OldBuffer := TSynEditStringList(FLines);
|
||||||
|
|
||||||
Flines := NewBuffer;
|
Flines := NewBuffer;
|
||||||
|
TSynEditStringList(FLines).AttachSynEdit(Self);
|
||||||
TSynEditStringsLinked(FTopLinesView).NextLines := FLines;
|
TSynEditStringsLinked(FTopLinesView).NextLines := FLines;
|
||||||
|
|
||||||
// Todo: Todo Refactor all classes with events, so they an be told to re-attach
|
// Todo: Todo Refactor all classes with events, so they an be told to re-attach
|
||||||
@ -5264,6 +5269,10 @@ begin
|
|||||||
FreeAndNil(FStrings);
|
FreeAndNil(FStrings);
|
||||||
FStrings := TSynEditLines.Create(TSynEditStringList(FLines), {$IFDEF FPC}@{$ENDIF}MarkTextAsSaved);
|
FStrings := TSynEditLines.Create(TSynEditStringList(FLines), {$IFDEF FPC}@{$ENDIF}MarkTextAsSaved);
|
||||||
|
|
||||||
|
// Flines has been set to the new buffer; and self is attached to the new FLines
|
||||||
|
// FTheLinesView points to new FLines
|
||||||
|
RecreateMarkList;
|
||||||
|
|
||||||
// Attach Highlighter
|
// Attach Highlighter
|
||||||
if FHighlighter <> nil then
|
if FHighlighter <> nil then
|
||||||
FHighlighter.AttachToLines(FLines);
|
FHighlighter.AttachToLines(FLines);
|
||||||
@ -5274,8 +5283,11 @@ begin
|
|||||||
TempPlugins.Free;
|
TempPlugins.Free;
|
||||||
|
|
||||||
RemoveHandlers(OldBuffer);
|
RemoveHandlers(OldBuffer);
|
||||||
|
OldBuffer.DetachSynEdit(Self);
|
||||||
FLines.SendNotification(senrTextBufferChanged, OldBuffer); // Send the old buffer
|
FLines.SendNotification(senrTextBufferChanged, OldBuffer); // Send the old buffer
|
||||||
OldBuffer.SendNotification(senrTextBufferChanged, OldBuffer); // Send the old buffer
|
OldBuffer.SendNotification(senrTextBufferChanged, OldBuffer); // Send the old buffer
|
||||||
|
if OldBuffer.AttachedSynEditCount = 0 then
|
||||||
|
OldBuffer.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomSynEdit.IsMarkListShared: Boolean;
|
function TCustomSynEdit.IsMarkListShared: Boolean;
|
||||||
@ -5354,22 +5366,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.ShareTextBufferFrom(AShareEditor: TCustomSynEdit);
|
procedure TCustomSynEdit.ShareTextBufferFrom(AShareEditor: TCustomSynEdit);
|
||||||
var
|
|
||||||
OldBuffer: TSynEditStringList;
|
|
||||||
begin
|
begin
|
||||||
if fPaintLock <> 0 then RaiseGDBException('Cannot change TextBuffer while paintlocked');
|
if fPaintLock <> 0 then RaiseGDBException('Cannot change TextBuffer while paintlocked');
|
||||||
OldBuffer := TSynEditStringList(FLines);
|
|
||||||
|
|
||||||
DestroyMarkList;
|
|
||||||
ChangeTextBuffer(TSynEditStringList(AShareEditor.FLines));
|
ChangeTextBuffer(TSynEditStringList(AShareEditor.FLines));
|
||||||
TSynEditStringList(FLines).AttachSynEdit(Self);
|
|
||||||
// lost the textbuffer, all marks are invalidate
|
|
||||||
RecreateMarkList;
|
|
||||||
|
|
||||||
OldBuffer.DetachSynEdit(Self);
|
|
||||||
if OldBuffer.AttachedSynEditCount = 0 then
|
|
||||||
OldBuffer.Free;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.UnShareTextBuffer;
|
procedure TCustomSynEdit.UnShareTextBuffer;
|
||||||
@ -5378,11 +5378,7 @@ begin
|
|||||||
if TSynEditStringList(FLines).AttachedSynEditCount = 1 then
|
if TSynEditStringList(FLines).AttachedSynEditCount = 1 then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
DestroyMarkList;
|
|
||||||
TSynEditStringList(FLines).DetachSynEdit(Self);
|
|
||||||
ChangeTextBuffer(TSynEditStringList.Create);
|
ChangeTextBuffer(TSynEditStringList.Create);
|
||||||
// lost the textbuffer, all marks are invalidate
|
|
||||||
RecreateMarkList;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.RemoveHandlers(ALines: TSynEditStrings = nil);
|
procedure TCustomSynEdit.RemoveHandlers(ALines: TSynEditStrings = nil);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user