SynEdit: prevent crash, when deleting lines which have a mark

git-svn-id: trunk@28129 -
This commit is contained in:
martin 2010-11-07 19:16:04 +00:00
parent 82e943fc36
commit 37980ef821

View File

@ -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);