删除光标所在行代码、段复制、剪切、粘贴代码。对需要整体移动代码段很方便。
建议快捷键:删除行(ctrl+D);段复制(ctrl+shift+C)这个和系统快捷键冲突,不过可以夺过来;段剪切(ctrl+shift+X);段粘贴(ctrl+shift+V)
删除行
program DeletePlus;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
Clipboard: TClipboard;
begin
Lines := TStringList.Create;
Clipboard := TClipboard.Create;
try
Lines.Clear;
IdeSetEditorSelectedLines(Lines);
finally
Lines.Free;
Clipboard.Free;
end;
end.
段复制
program CopyPlus;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
Clipboard: TClipboard;
i: Integer;
begin
Lines := TStringList.Create;
Clipboard := TClipboard.Create;
try
if IdeGetEditorSelectedLines(Lines) then
begin
Clipboard.Clear;
Clipboard.AsText := Lines.Text;
end;
finally
Lines.Free;
Clipboard.Free;
end;
end.
段剪切
program CutPlus;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
Clipboard: TClipboard;
i: Integer;
begin
Lines := TStringList.Create;
Clipboard := TClipboard.Create;
try
if IdeGetEditorSelectedLines(Lines) then
begin
Clipboard.Clear;
Clipboard.AsText := Lines.Text;
Lines.Clear;
IdeSetEditorSelectedLines(Lines);
end;
finally
Lines.Free;
Clipboard.Free;
end;
end.
段粘贴
program PastePlus;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd;
var
Lines: TStringList;
Clipboard: TClipboard;
begin
Lines := TStringList.Create;
Clipboard := TClipboard.Create;
try
if Clipboard.HasFormat(1) then
begin
if IdeGetEditorSelectedLines(Lines) then
begin
Lines.Text := Clipboard.AsText + Lines.Text;
IdeSetEditorSelectedLines(Lines);
end;
end;
finally
Lines.Free;
Clipboard.Free;
end;
end.