「TeraPadのCtrl↑と同じような動作をするマクロ」の版間の差分
ナビゲーションに移動
検索に移動
URLを修正 |
windowの記述を省略 |
||
| 23行目: | 23行目: | ||
}else{ | }else{ | ||
//window内に表示されている文章行数を取得 | //window内に表示されている文章行数を取得 | ||
Redraw=false; | |||
Document.Selection.SetActivePoint(mePosView , 1, ScrollY, false); | Document.Selection.SetActivePoint(mePosView , 1, ScrollY, false); | ||
Document.Selection.PageDown(true); | Document.Selection.PageDown(true); | ||
| 29行目: | 29行目: | ||
Document.Selection.PageUp (false); | Document.Selection.PageUp (false); | ||
Document.Selection.SetActivePoint(mePosView , cursorX, cursorY, false); | Document.Selection.SetActivePoint(mePosView , cursorX, cursorY, false); | ||
Redraw=true; | |||
if (cursorY > sy+viewLines - 3){//カーソルが表示されているところからなくならないように | if (cursorY > sy+viewLines - 3){//カーソルが表示されているところからなくならないように | ||
2026年10月30日 (金) 03:56時点における版
概要
2chで要望があったので作ってみました。
window内に表示されている文章行数を取得する方法を思いついたので。
ソースコード
/*
TeraPadのCtrl+↑と同じような動作
*/
// カーソル位置を保存
var cursorX=Document.Selection.GetActivePointX(mePosView);
var cursorY=Document.Selection.GetActivePointY(mePosView);
// スクロール位置を保存
var sx = ScrollX;
var sy = ScrollY;
//表示されている一番下の行は sy+viewLines で表すことが出来る
if (ScrollY == 1){//スクロール出来なくなったときはカーソルが上がるだけ
Document.Selection.SetActivePoint(mePosView , cursorX, cursorY -1, false);
}else{
//window内に表示されている文章行数を取得
Redraw=false;
Document.Selection.SetActivePoint(mePosView , 1, ScrollY, false);
Document.Selection.PageDown(true);
var viewLines =Document.Selection.GetBottomPointY(mePosView ) - Document.Selection.GetTopPointY(mePosView );
Document.Selection.PageUp (false);
Document.Selection.SetActivePoint(mePosView , cursorX, cursorY, false);
Redraw=true;
if (cursorY > sy+viewLines - 3){//カーソルが表示されているところからなくならないように
Document.Selection.SetActivePoint(mePosView , cursorX, cursorY -1, false);
}
ScrollX = sx;
ScrollY = sy -1;
}
スポンサーリンク