最終行↓キーでカーソルを行末に、先頭行↑キーで行頭に
いつも利用させていただいています。
・最終行のどこかにカーソルがある状態で↓キーを押すと、カーソルを最終行末に移動
・同様に、先頭行のどこかにカーソルがある状態で↑キーを押すと、カーソルを先頭行頭に移動
という動作を希望します。
Visual Studio CodeやEclipseと同様の動きです。
最終行の動きは、ノートPCなどのHome/Endキーが押しづらいキーボードで、最終行の次に行を足す際に便利です。
よろしくお願いします。
nory 様
いつもお世話になっております。
以下のようなマクロを作成し、それぞれ下矢印、上矢印のキーに割り当てていただければ、ご希望の動作になります。
LineDown.jsee
y = document.selection.GetActivePointY(eePosLogical);
document.selection.LineDown(false,1);
if( y == document.selection.GetActivePointY(eePosLogical) ) {
document.selection.EndOfLine(false,eeLineLogical);
}
LineUp.jsee
y = document.selection.GetActivePointY(eePosLogical);
document.selection.LineUp(false,1);
if( y == document.selection.GetActivePointY(eePosLogical) ) {
document.selection.StartOfLine(false,eeLineLogical);
}
よろしくお願い申し上げます。
ご回答ありがとうございます。
概ね希望通りの動作になりました。ありがとうございます。
ただ、矢印キーのたびにマウスカーソルがビジーになるのと、このマクロでは仕方ありませんが、最終行末や先頭行頭に移動した時点でカーソルの水平位置がリセットされてしまうのが残念です。
できましたら、機能として実装を検討していただけると嬉しいです。
nory 様
いつもお世話になっております。
さきほど公開した v20.6.1 と v20.6.904 では、マクロ開始時にマウス カーソルがビジーにならないようにしました。また、最終行末や先頭行頭に移動した時点でカーソルの水平位置がリセットされないように、マクロを改良しました。お試しください。
LineDown.jsee
y = document.selection.GetActivePointY(eePosLogical);
x = document.selection.GetActivePointX(eePosLogical);
if( x == 1 && y == 1 ) {
x = editor.GetProfileInt( eeRegEmEditorUsers, "test", "SaveX", 0 );
editor.WriteProfileInt( eeRegEmEditorUsers, "test", "SaveX", 0 );
if( x > 1 ) {
document.selection.SetActivePoint(eePosLogical, x, y );
Quit();
}
}
document.selection.LineDown(false,1);
if( y == document.selection.GetActivePointY(eePosLogical) ) {
x = document.selection.GetActivePointX(eePosLogical);
nLastLineLen = document.GetLine( y ).length;
if( x != nLastLineLen + 1 ) {
document.selection.EndOfLine(false,eeLineLogical);
editor.WriteProfileInt( eeRegEmEditorUsers, "test", "SaveX", x );
}
}
LineUp.jsee
y = document.selection.GetActivePointY(eePosLogical);
x = document.selection.GetActivePointX(eePosLogical);
yLines = document.GetLines();
if( y == yLines ) {
nLastLineLen = document.GetLine( y ).length;
if( x == nLastLineLen + 1 ) {
x = editor.GetProfileInt( eeRegEmEditorUsers, "test", "SaveX", 0 );
editor.WriteProfileInt( eeRegEmEditorUsers, "test", "SaveX", 0 );
if( x >= 1 ) {
document.selection.SetActivePoint(eePosLogical, x, y );
Quit();
}
}
}
document.selection.LineUp(false,1);
if( y == document.selection.GetActivePointY(eePosLogical) ) {
x = document.selection.GetActivePointX(eePosLogical);
if( x != 1 ) {
document.selection.StartOfLine(false,eeLineLogical);
editor.WriteProfileInt( eeRegEmEditorUsers, "test", "SaveX", x );
}
}
よろしくお願い申し上げます。
横からすみません
「それぞれ下矢印、上矢印のキーに割り当てていただければ、ご希望の動作になります。」
これの方法を教えていただけませんでしょうか。
マクロ→カスタマイズ→登録 からでしょうか。
KawakamiTakahiro 様
いつもお世話になっております。
[ツール] メニューの [すべての設定のプロパティ] を選択し、[キーボード] ページで、キーの割り当てを変更していただけます。
よろしくお願い申し上げます。
このトピックの投稿: 6