mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:59:13 +02:00
SynEdit: prevent crash, when deleting lines which have a mark
git-svn-id: trunk@28129 -
This commit is contained in:
parent
82e943fc36
commit
37980ef821
@ -1118,7 +1118,7 @@ procedure TSynEditMarkList.DoLinesEdited(Sender: TSynEditStrings; aLinePos, aByt
|
|||||||
aLineBrkCnt: Integer; aText: String);
|
aLineBrkCnt: Integer; aText: String);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
CurLine: TSynEditMarkLine;
|
CurLine, NextLine: TSynEditMarkLine;
|
||||||
LinePos, LineBSize: Integer;
|
LinePos, LineBSize: Integer;
|
||||||
f: Boolean;
|
f: Boolean;
|
||||||
Mrk: TSynEditMark;
|
Mrk: TSynEditMark;
|
||||||
@ -1151,6 +1151,7 @@ begin
|
|||||||
if (LinePos = aLinePos) then
|
if (LinePos = aLinePos) then
|
||||||
CurLine := TSynEditMarkLine(CurLine.Successor(LinePos, LineBSize));
|
CurLine := TSynEditMarkLine(CurLine.Successor(LinePos, LineBSize));
|
||||||
while (CurLine <> nil) and (LinePos <= aLinePos - aLineBrkCnt) do begin
|
while (CurLine <> nil) and (LinePos <= aLinePos - aLineBrkCnt) do begin
|
||||||
|
NextLine := TSynEditMarkLine(CurLine.Successor(LinePos, LineBSize));
|
||||||
f := LinePos = aLinePos - aLineBrkCnt;
|
f := LinePos = aLinePos - aLineBrkCnt;
|
||||||
i := CurLine.Count - 1;
|
i := CurLine.Count - 1;
|
||||||
while i >= 0 do begin
|
while i >= 0 do begin
|
||||||
@ -1162,7 +1163,7 @@ begin
|
|||||||
Mrk.Column := aBytePos; // or delete ?
|
Mrk.Column := aBytePos; // or delete ?
|
||||||
dec(i);
|
dec(i);
|
||||||
end;
|
end;
|
||||||
CurLine := TSynEditMarkLine(CurLine.Successor(LinePos, LineBSize));
|
CurLine := NextLine;
|
||||||
end;
|
end;
|
||||||
if CurLine <> nil then FInternalIterator.GotoMark(CurLine[0]); // TODO: better notification system
|
if CurLine <> nil then FInternalIterator.GotoMark(CurLine[0]); // TODO: better notification system
|
||||||
FMarkLines.AdjustForLinesDeleted(aLinePos + 1, -aLineBrkCnt);
|
FMarkLines.AdjustForLinesDeleted(aLinePos + 1, -aLineBrkCnt);
|
||||||
|
Loading…
Reference in New Issue
Block a user