「矩形選択範囲の各行先頭に文字挿入」の版間の差分
SyntaxHighlightにcopyの追加 |
ソースコードを修正 |
||
| (同じ利用者による、間の1版が非表示) | |||
| 18行目: | 18行目: | ||
// ステータスバー初期化 | // ステータスバー初期化 | ||
Status = "" | Status = ""; | ||
// 矩形選択判定 | // 矩形選択判定 | ||
var s = | var s = document.selection; | ||
var isBoxed = (s.GetBottomPointY(mePosView) - s.GetTopPointY(mePosView)) != (s.Text.match(/\n/g) || []).length; | var isBoxed = (s.GetBottomPointY(mePosView) - s.GetTopPointY(mePosView)) != (s.Text.match(/\n/g) || []).length; | ||
if (isBoxed) { | if (isBoxed) { | ||
var Ptr = "^"; | |||
var Rep = Prompt("挿入する文字列", "").replace(/\\/g, "\\\\"); | |||
// 挿入文字が空ではない場合のみ、置換実行 | |||
if (Rep) { | |||
document.selection.Replace(Ptr, Rep, meFindReplaceRegExp + meReplaceSelOnly + meReplaceAll); | |||
editor.ActiveDocument.HighlightFind = false; | |||
} | |||
} else { | } else { | ||
Status = "矩形選択がされていません。"; | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
スポンサーリンク