「選択範囲を上下に移動」の版間の差分
ソースコードの整形 |
行番号をクリック&ドラッグで行を範囲選択した状態でマクロを実行すると移動する行が1行増える不具合を修正 |
||
| (同じ利用者による、間の2版が非表示) | |||
| 13行目: | 13行目: | ||
#title = "選択範囲を上へ移動" | #title = "選択範囲を上へ移動" | ||
var s = | var s = document.selection; | ||
var ty = s.GetTopPointY(mePosLogical); | var ty = s.GetTopPointY(mePosLogical); | ||
var by = s.GetBottomPointY(mePosLogical); | var by = s.GetBottomPointY(mePosLogical); | ||
var bx = s.GetBottomPointX(mePosLogical); | |||
// 選択範囲の末尾が行頭にあるときの調整 | |||
if (ty != by && bx == 1) { | |||
by--; | |||
} | |||
if (ty > 1) { | if (ty > 1) { | ||
Redraw = false; | Redraw = false; | ||
| 22行目: | 29行目: | ||
// ブックマークの待避 | // ブックマークの待避 | ||
var bookmarkList = GetBookmarkList( | var bookmarkList = GetBookmarkList(document, ty - 1, by, true); | ||
// 選択行を上へ移動 | // 選択行を上へ移動 | ||
| 59行目: | 66行目: | ||
top = (top == null || top < 1) ? 1 : top; | top = (top == null || top < 1) ? 1 : top; | ||
bottom = (bottom == null || bottom > lines) ? lines : bottom; | bottom = (bottom == null || bottom > lines) ? lines : bottom; | ||
var s = doc. | var s = doc.selection; | ||
var b = []; | var b = []; | ||
if (lines == 1) { | if (lines == 1) { | ||
| 93行目: | 100行目: | ||
#title = "選択範囲を下へ移動" | #title = "選択範囲を下へ移動" | ||
var s = | var s = document.selection; | ||
var ty = s.GetTopPointY(mePosLogical); | var ty = s.GetTopPointY(mePosLogical); | ||
var by = s.GetBottomPointY(mePosLogical); | var by = s.GetBottomPointY(mePosLogical); | ||
if ( | var bx = s.GetBottomPointX(mePosLogical); | ||
// 選択範囲の末尾が行頭にあるときの調整 | |||
if (ty != by && bx == 1) { | |||
by--; | |||
} | |||
if (document.GetLines(0) > by) { | |||
Redraw = false; | Redraw = false; | ||
var sx = ScrollX; | var sx = ScrollX; | ||
| 102行目: | 116行目: | ||
// ブックマークの待避 | // ブックマークの待避 | ||
var bookmarkList = GetBookmarkList( | var bookmarkList = GetBookmarkList(document, ty, by + 1, true); | ||
// 選択行を下へ移動 | // 選択行を下へ移動 | ||
| 139行目: | 153行目: | ||
top = (top == null || top < 1) ? 1 : top; | top = (top == null || top < 1) ? 1 : top; | ||
bottom = (bottom == null || bottom > lines) ? lines : bottom; | bottom = (bottom == null || bottom > lines) ? lines : bottom; | ||
var s = doc. | var s = doc.selection; | ||
var b = []; | var b = []; | ||
if (lines == 1) { | if (lines == 1) { | ||
スポンサーリンク