function GetTrimmedSelection() {
var Sel = Editor.Selection;
if ((Sel.SelStartLine < Sel.SelEndLine) && (Sel.SelEndCol == 0)) {
Sel.SelEndLine--;
Sel.SelEndCol = Length(Editor.LinesAsDisplayed[Sel.SelEndLine]);
}
return Sel;
}
function MoveUp(Sender) {
var Sel = GetTrimmedSelection();
if ((Sel.SelStartLine > 0) && (Sel.SelEndLine > 0)) {
Editor.BeginEditing;
var line, line2;
for (var f = Sel.SelStartLine; f <= Sel.SelEndLine; f++) {
line = Editor.Lines[f - 1];
line2 = Editor.Lines[f];
Editor.Lines[f - 1] = line2;
Editor.Lines[f] = line;
}
Sel.SelStartLine = Sel.SelStartLine - 1;
Sel.SelEndLine = Sel.SelEndLine - 1;
Editor.Selection = Sel;
Editor.EndEditing;
}
}
function MoveDown(Sender) {
var Sel = GetTrimmedSelection();
if (Sel.SelEndLine < Editor.LineCount - 1) {
Editor.BeginEditing;
var line, line2;
for (f = Sel.SelEndLine; f >= Sel.SelStartLine; f--) {
line = Editor.Lines[f];
line2 = Editor.Lines[f + 1];
Editor.Lines[f] = line2;
Editor.Lines[f + 1] = line;
}
Sel.SelStartLine = Sel.SelStartLine + 1;
Sel.SelEndLine = Sel.SelEndLine + 1;
Editor.Selection = Sel;
Editor.EndEditing;
}
}
Script.RegisterDocumentAction("Move Selected Lines", "Move Selected Lines Up", "Shift+Ctrl+Up", &MoveUp);
Script.RegisterDocumentAction("Move Selected Lines", "Move Selected Lines Down", "Shift+Ctrl+Down", &MoveDown);
function GoToLastRow(Sender) {
Editor.SelectAll;
var sel = Editor.Selection;
sel.SelStartLine = sel.SelEndLine;
Editor.Selection = sel;
sel = Editor.Selection;
sel.SelStartColReal = sel.SelEndColReal;
Editor.Selection = sel;
} // GoToLastRow
Return to Plugins for HTMLPad / Rapid CSS / Rapid PHP / WeBuilder
Users browsing this forum: No registered users and 16 guests