Revisiting a post from a while back :-)) Attached is a script that adds a bit
more brief emulation to the keymap above.
Home and End keys will now work as per Brief, as will ALT+J for go to bookmark.
Unfortunately, you will end up with menu items for Brief Home, Brief End, and
Brief GoToBookMark under the Scripts -> Brief Emul menu. Is there any way to
assign a key to a script function without having a menu item?
Copy the following text and save it as BriefEmul.js in the script in the
Script\JScript directory
Turn off Extended Home key and Extended End key in Settings -> Program Settings
-> Editor (part 1)
Copy the above keymap file and save it off. Remove the ALT+J from aMarkList in
the [Bookmark] paragraph, since this seems to block it's usage in the script.
You also should change the ecSetMarker0 under [Editor] to be ALT+0 to be more
accurate.
============== BriefEmul.js ===============
// JavaScript Document
var module_name = "BriefEmul";
var module_ver = "0.2";
var module_title = "Brief emulation";
function BriefGoToMark()
{
var wnd;
var bookNum;
var goToCmd;
// Get active editor window
wnd = newEditor();
wnd.assignActiveEditor();
// Get the booknmake number
bookNum = inputText("Bookmark number: "," ");
if ((bookNum >= 1) && (bookNum <= 9))
{
goToCmd = "ecGoToMarker" + bookNum;
wnd.command(goToCmd);
return;
}
if (bookNum == "0")
{
goToCmd = "ecGoToMarker" + bookNum;
wnd.command(goToCmd);
return;
}
}
function BriefEnd()
{
var wnd;
var startX;
var startY;
// Get active editor window
wnd = newEditor();
wnd.assignActiveEditor();
// Where are we now?
startX = wnd.caretX();
startY = wnd.caretY();
// First go to end of line and if we moved, then we're done
wnd.command("ecLineEnd");
if (startX != wnd.caretX())
{
// End of line moved, so we're done
return;
}
// Second go to end of screen, end of line and if we moved, then we're done
wnd.command("ecPageBottom");
wnd.command("ecLineEnd");
if (startY != wnd.caretY())
{
// End of screen moved, so we're done
return;
}
// Okay, we were already at the end of page, so go to end of file
wnd.command("ecEditorBottom");
return;
}
function BriefHome()
{
var wnd;
var startX;
var startY;
// Get active editor window
wnd = newEditor();
wnd.assignActiveEditor();
// Where are we now?
startX = wnd.caretX();
startY = wnd.caretY();
// First go to start of line and if we moved, then we're done
wnd.command("ecLineStart");
if (startX != wnd.caretX())
{
// End of line moved, so we're done
return;
}
// Second go to top of screen, start of line and if we moved, then we're done
wnd.command("ecPageTop");
wnd.command("ecLineStart");
if (startY != wnd.caretY())
{
// End of screen moved, so we're done
return;
}
// Okay, we were already at the top of page, so go to start of file
wnd.command("ecEditorTop");
return;
}
function Init()
{
addMenuItem("Brief Home", "Brief Emul", "BriefHome", "HOME");
addMenuItem("Brief End", "Brief Emul", "BriefEnd", "END");
addMenuItem("Brief GoToMark", "Brief Emul", "BriefGoToMark", "ALT+J");
}
--
<http://forum.pspad.com/read.php?2,19005,52715>
PSPad freeware editor http://www.pspad.com