Skip to content

Instantly share code, notes, and snippets.

@hokorobi
Last active October 12, 2015 10:38
Show Gist options
  • Save hokorobi/1393114 to your computer and use it in GitHub Desktop.
Save hokorobi/1393114 to your computer and use it in GitHub Desktop.
PPx markcursor
//!*script
// 直前のマークからカーソル位置までマーク
// PPx 1.45 x64 + Script Module R14
var e = PPx.Entry;
// ディレクトリ内のエントリが一つの場合は何もしない
if (e.length < 2) PPx.Quit();
var lastEntry = e.Index; // カーソル位置。ここまでマークする
e.LastMark; // 最後にマークしたエントリへカーソルを移動
var firstEntry = e.Index; // マーク開始位置
var diff = lastEntry - firstEntry; // マークとカーソルの距離
// 同じ位置だったら何もしない
if (diff == 0) PPx.Quit();
var j = diff > 0 ? 1 : -1; // マークとカーソルの位置関係に応じて進行方向を決定
diff += j; // lastEntry もマークするため補正
// カーソル位置までマーク
for (var i = j; diff != i; i += j) e(firstEntry + i).Mark = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment