Built-in functionality duplicates a single line. If that's not enough then you need this plugin.
Updated: Bugfix, did not work on 1st line.
function DupLines(Sender) {
var Sel = Editor.Selection;
if ((Sel.SelStartLine >= 0) && (Sel.SelEndLine >= 0)) {
Editor.BeginEditing;
//get selection start/end lines and shrink selection if last selected line is not really selected
var start = Sel.SelStartLine;
var end = Sel.SelEndLine;
if ((end > start) && (Sel.SelEndCol == 0)) {
end--;
}
//create duplicate of the selected lines
var line;
var s = "";
for (var f = start; f <= end; f++) {
line = Editor.Lines[f];
s += line + "\n";
}
//move selection to end of current selection and append the duplicated text
Sel.SelStartLine = end + 1;
Sel.SelStartCol = 0;
Sel.SelEndLine = Sel.SelStartLine;
Sel.SelEndCol = 0;
Editor.Selection = Sel;
Editor.SelText = s;
Editor.EndEditing;
}
}
Script.RegisterDocumentAction("", "Duplicate Selected Lines", "Ctrl+D", &DupLines);
Return to Plugins for HTMLPad / Rapid CSS / Rapid PHP / WeBuilder
Users browsing this forum: No registered users and 32 guests