「矩形選択範囲の各行先頭に文字挿入」の版間の差分
ソースコードを整形 |
ソースコードを修正 |
||
| 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 Ptr = "^"; | ||
var Rep = | var Rep = Prompt("挿入する文字列", "").replace(/\\/g, "\\\\"); | ||
// 挿入文字が空ではない場合のみ、置換実行 | // 挿入文字が空ではない場合のみ、置換実行 | ||
if (Rep) { | if (Rep) { | ||
document.selection.Replace(Ptr, Rep, meFindReplaceRegExp + meReplaceSelOnly + meReplaceAll); | document.selection.Replace(Ptr, Rep, meFindReplaceRegExp + meReplaceSelOnly + meReplaceAll); | ||
editor.ActiveDocument.HighlightFind = false; | |||
} | } | ||
} else { | } else { | ||
Status = "矩形選択がされていません。" | Status = "矩形選択がされていません。"; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
スポンサーリンク