選択範囲を上下に移動
概要
選択されている範囲を 1 行上下します.
(某所よりログが流れてしまうため待避)
コード
下へ移動
var s = Document.Selection;
var ty = s.GetTopPointY(mePosLogical);
var by = s.GetBottomPointY(mePosLogical);
if (Document.GetLines(0) > by) {
SelectLine(s, ty, by+1);
var a = s.Text.split("\n");
a.unshift(a.pop());
s.Text = a.join("\n");
SelectLine(s, ty+1, by+1);
}
function SelectLine(s, ty, by) {
s.SetAnchorPoint(mePosLogical, 1, ty);
s.SetActivePoint(mePosLogical, 1, by, true);
s.EndOfLine(true, mePosLogical);
}
下へ移動
var s = Document.Selection;
var ty = s.GetTopPointY(mePosLogical);
var by = s.GetBottomPointY(mePosLogical);
if (ty > 1) {
SelectLine(s, ty-1, by);
var a = s.Text.split("\n");
a.push(a.shift());
s.Text = a.join("\n");
SelectLine(s, ty-1, by-1);
}
function SelectLine(s, ty, by) {
s.SetAnchorPoint(mePosLogical, 1, ty);
s.SetActivePoint(mePosLogical, 1, by, true);
s.EndOfLine(true, mePosLogical);
}
スポンサーリンク