1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 04:07:58 +01:00

began moving some mappings from mappings.js -> buffer.js; Also the constructors of Mail() and Buffer() accept an argument in which mode they should add the mapping

This commit is contained in:
Martin Stubenschrott
2008-02-14 15:00:05 +00:00
parent e652d53e5d
commit 3b461b18c2
5 changed files with 68 additions and 53 deletions

View File

@@ -26,11 +26,12 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/
vimperator.Buffer = function () //{{{
vimperator.Buffer = function (browserModes) //{{{
{
////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
var modes = browserModes || [vimperator.modes.NORMAL];
var zoomLevels = [ 1, 10, 25, 50, 75, 90, 100,
120, 150, 200, 300, 500, 1000, 2000 ];
@@ -139,19 +140,6 @@ vimperator.Buffer = function () //{{{
win.scrollTo(h, v);
}
vimperator.commands.addUserCommand(new vimperator.Command(["test"],
function (args, special)
{
alert(args)
},
{
shortHelp: "Test command"
}
));
vimperator.mappings.add([vimperator.modes.NORMAL], ["w"], "Test",
function () { alert("test"); }
);
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// OPTIONS /////////////////////////////////////////////////
@@ -194,6 +182,42 @@ vimperator.Buffer = function () //{{{
getter: function () { return getMarkupDocumentViewer().authorStyleDisabled; },
});
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// MAPPINGS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
vimperator.mappings.add(modes, ["i", "<Insert>"],
"Start caret mode",
function ()
{
// setting this option triggers an observer which takes care of the mode setting
vimperator.options.setPref("accessibility.browsewithcaret", true);
});
vimperator.mappings.add(modes, ["j", "<Down>", "<C-e>"],
"Scroll document down",
function (count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); },
{ flags: vimperator.Mappings.flags.COUNT });
vimperator.mappings.add(modes, ["k", "<Up>", "<C-y>"],
"Scroll document up",
function (count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); },
{ flags: vimperator.Mappings.flags.COUNT });
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
vimperator.commands.addUserCommand(new vimperator.Command(["test"],
function (args, special)
{
alert(args)
},
{
shortHelp: "Test command"
}
));
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{