ide: redo TSourceEditor.InsertLine (fixes bug #0021493)

git-svn-id: trunk@36335 -
This commit is contained in:
paul 2012-03-26 01:39:28 +00:00
parent 9cd7420323
commit 7b476a6856

View File

@ -4271,12 +4271,18 @@ procedure TSourceEditor.InsertLine(StartLine: Integer; const NewText: String;
aKeepMarks: Boolean);
const
MarksMode: array[Boolean] of TSynMarksAdjustMode = (smaMoveUp, smaKeep);
var
Pt: TPoint;
begin
if not ReadOnly then
FEditor.SetTextBetweenPoints(
Point(1, StartLine),
Point(1, StartLine),
NewText + LineEnding, [], scamEnd, MarksMode[aKeepMarks]);
begin
if StartLine > 1 then
Pt := Point(Length(FEditor.Lines[StartLine - 2]) + 1, StartLine - 1)
else
Pt := Point(1, 1);
FEditor.SetTextBetweenPoints(Pt, Pt,
LineEnding + NewText, [], scamEnd, MarksMode[aKeepMarks]);
end;
end;
procedure TSourceEditor.ReplaceLines(StartLine, EndLine: integer;