ideintf, ide: add InsertLine method

git-svn-id: trunk@36186 -
This commit is contained in:
paul 2012-03-21 04:11:51 +00:00
parent d46180aa2f
commit 0e0b2fa192
2 changed files with 14 additions and 0 deletions

View File

@ -377,6 +377,7 @@ type
function SelectionAvailable: boolean; override;
function GetText(OnlySelection: boolean): string; override;
procedure SelectText(const StartPos, EndPos: TPoint); override;
procedure InsertLine(StartLine: Integer; const NewText: String; aKeepMarks: Boolean = False); override;
procedure ReplaceLines(StartLine, EndLine: integer; const NewText: string; aKeepMarks: Boolean = False); override;
procedure EncloseSelection;
procedure UpperCaseSelection;
@ -4271,6 +4272,18 @@ Begin
FEditor.BlockEnd := EndPos;
end;
procedure TSourceEditor.InsertLine(StartLine: Integer; const NewText: String;
aKeepMarks: Boolean);
const
MarksMode: array[Boolean] of TSynMarksAdjustMode = (smaMoveUp, smaKeep);
begin
if not ReadOnly then
FEditor.SetTextBetweenPoints(
Point(1, StartLine),
Point(1, StartLine),
NewText + LineEnding, [], scamEnd, MarksMode[aKeepMarks]);
end;
procedure TSourceEditor.ReplaceLines(StartLine, EndLine: integer;
const NewText: string; aKeepMarks: Boolean = False);
const

View File

@ -116,6 +116,7 @@ type
function GetText(OnlySelection: boolean): string; virtual; abstract;
procedure SelectText(LineNum, CharStart, LineNum2, CharEnd: Integer);
procedure SelectText(const StartPos, EndPos: TPoint); virtual; abstract;
procedure InsertLine(StartLine: Integer; const NewText: String; aKeepMarks: Boolean = False); virtual; abstract;
procedure ReplaceLines(StartLine, EndLine: integer; const NewText: string; aKeepMarks: Boolean = False); virtual; abstract;
procedure ReplaceText(const StartPos, EndPos: TPoint; const NewText: string);
procedure AskReplace(Sender: TObject; const ASearch, AReplace: string;