mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 00:32:27 +01:00
Check (v[0] in orig || orig[v[0]]) in JS completion again. The latter catches a lot of members in XPC wrapped objects
This commit is contained in:
@@ -475,7 +475,10 @@ function Events() //{{{
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (liberator.has("tabs"))
|
if (liberator.has("tabs"))
|
||||||
|
{
|
||||||
args.tab = tabs.getContentIndex(doc) + 1;
|
args.tab = tabs.getContentIndex(doc) + 1;
|
||||||
|
args.doc = "tabs.getTab(" + (args.tab - 1) + ").linkedBrowser.contentDocument";
|
||||||
|
}
|
||||||
|
|
||||||
autocommands.trigger(name, args);
|
autocommands.trigger(name, args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,12 +94,16 @@ function Mappings() //{{{
|
|||||||
function addMap(map, userMap)
|
function addMap(map, userMap)
|
||||||
{
|
{
|
||||||
var where = userMap ? user : main;
|
var where = userMap ? user : main;
|
||||||
map.modes.forEach(function (mode) { where[mode].push(map); });
|
map.modes.forEach(function (mode) {
|
||||||
|
if (!(mode in where))
|
||||||
|
where[mode] = [];
|
||||||
|
where[mode].push(map);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMap(mode, cmd, stack)
|
function getMap(mode, cmd, stack)
|
||||||
{
|
{
|
||||||
var maps = stack[mode];
|
var maps = stack[mode] || [];
|
||||||
|
|
||||||
for (let [,map] in Iterator(maps))
|
for (let [,map] in Iterator(maps))
|
||||||
{
|
{
|
||||||
@@ -112,7 +116,7 @@ function Mappings() //{{{
|
|||||||
|
|
||||||
function removeMap(mode, cmd)
|
function removeMap(mode, cmd)
|
||||||
{
|
{
|
||||||
var maps = user[mode];
|
var maps = user[mode] || [];
|
||||||
var names;
|
var names;
|
||||||
|
|
||||||
for (let [i, map] in Iterator(maps))
|
for (let [i, map] in Iterator(maps))
|
||||||
|
|||||||
@@ -61,28 +61,9 @@ const modes = (function () //{{{
|
|||||||
ext += " (menu)";
|
ext += " (menu)";
|
||||||
ext += " --" + macromode;
|
ext += " --" + macromode;
|
||||||
|
|
||||||
switch (main)
|
if (main in modeMap && typeof modeMap[main].display == "function")
|
||||||
{
|
return "-- " + modeMap[main].display() + ext;
|
||||||
case modes.INSERT:
|
return macromode;
|
||||||
return "-- INSERT" + ext;
|
|
||||||
case modes.VISUAL:
|
|
||||||
return "-- VISUAL" + (extended & modes.LINE ? " LINE" : "") + ext;
|
|
||||||
case modes.COMMAND_LINE:
|
|
||||||
// under modes.COMMAND_LINE, this function will never be called
|
|
||||||
return macromode;
|
|
||||||
case modes.CARET:
|
|
||||||
return "-- CARET" + ext;
|
|
||||||
case modes.TEXTAREA:
|
|
||||||
return "-- TEXTAREA" + ext;
|
|
||||||
case modes.MESSAGE:
|
|
||||||
return "-- MESSAGE" + ext;
|
|
||||||
case modes.COMPOSE:
|
|
||||||
return "-- COMPOSE" + ext;
|
|
||||||
case modes.CUSTOM:
|
|
||||||
return "-- " + plugins.mode + ext;
|
|
||||||
default: // NORMAL mode
|
|
||||||
return macromode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Pay attention that you don't run into endless loops
|
// NOTE: Pay attention that you don't run into endless loops
|
||||||
@@ -150,36 +131,25 @@ const modes = (function () //{{{
|
|||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
return {
|
var self = {
|
||||||
|
|
||||||
// main modes, only one should ever be active
|
|
||||||
NONE: 0,
|
NONE: 0,
|
||||||
NORMAL: 1 << 0,
|
|
||||||
INSERT: 1 << 1,
|
|
||||||
VISUAL: 1 << 2,
|
|
||||||
COMMAND_LINE: 1 << 3,
|
|
||||||
CARET: 1 << 4, // text cursor is visible
|
|
||||||
TEXTAREA: 1 << 5, // text cursor is in a HTMLTextAreaElement
|
|
||||||
MESSAGE: 1 << 6, // for now only used in Muttator when the message has focus
|
|
||||||
COMPOSE: 1 << 7,
|
|
||||||
CUSTOM: 1 << 8,
|
|
||||||
// extended modes, can include multiple modes, and even main modes
|
|
||||||
EX: 1 << 9,
|
|
||||||
HINTS: 1 << 10,
|
|
||||||
INPUT_MULTILINE: 1 << 11,
|
|
||||||
OUTPUT_MULTILINE: 1 << 12,
|
|
||||||
SEARCH_FORWARD: 1 << 13,
|
|
||||||
SEARCH_BACKWARD: 1 << 14,
|
|
||||||
MENU: 1 << 15, // a popupmenu is active
|
|
||||||
LINE: 1 << 16, // linewise visual mode
|
|
||||||
RECORDING: 1 << 17,
|
|
||||||
PROMPT: 1 << 18,
|
|
||||||
|
|
||||||
__iterator__: function () util.Array.iterator(this.all),
|
__iterator__: function () util.Array.iterator(this.all),
|
||||||
|
|
||||||
get all() [this.NONE, this.NORMAL, this.INSERT, this.VISUAL,
|
get all() mainModes.slice(),
|
||||||
this.HINTS, this.COMMAND_LINE, this.CARET,
|
|
||||||
this.TEXTAREA, this.MESSAGE, this.COMPOSE, this.CUSTOM],
|
addMode: function (name, extended, display) {
|
||||||
|
let disp = name.replace("_", " ", "g");
|
||||||
|
this[name] = 1 << lastMode++;
|
||||||
|
modeMap[name] = modeMap[this[name]] = {
|
||||||
|
extended: extended,
|
||||||
|
mask: this[name],
|
||||||
|
name: name,
|
||||||
|
display: display || function () disp
|
||||||
|
};
|
||||||
|
if (!extended)
|
||||||
|
mainModes.push(this[name]);
|
||||||
|
},
|
||||||
|
|
||||||
// show the current mode string in the command line
|
// show the current mode string in the command line
|
||||||
show: function ()
|
show: function ()
|
||||||
@@ -289,6 +259,34 @@ const modes = (function () //{{{
|
|||||||
set extended(value) { extended = value; this.show(); }
|
set extended(value) { extended = value; this.show(); }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var mainModes = [self.NONE];
|
||||||
|
var lastMode = 0;
|
||||||
|
var modeMap = {};
|
||||||
|
|
||||||
|
// main modes, only one should ever be active
|
||||||
|
self.addMode("NORMAL", false, -1);
|
||||||
|
self.addMode("INSERT");
|
||||||
|
self.addMode("VISUAL", false, function () "VISUAL" + (extended & modes.LINE ? " LINE" : ""));
|
||||||
|
self.addMode("COMMAND_LINE");
|
||||||
|
self.addMode("CARET"); // text cursor is visible
|
||||||
|
self.addMode("TEXTAREA"); // text cursor is in a HTMLTextAreaElement
|
||||||
|
self.addMode("MESSAGE"); // for now only used in Muttator when the message has focus
|
||||||
|
self.addMode("COMPOSE");
|
||||||
|
self.addMode("CUSTOM", false, function () plugins.mode);
|
||||||
|
// extended modes, can include multiple modes, and even main modes
|
||||||
|
self.addMode("EX", true);
|
||||||
|
self.addMode("HINTS", true);
|
||||||
|
self.addMode("INPUT_MULTILINE", true);
|
||||||
|
self.addMode("OUTPUT_MULTILINE", true);
|
||||||
|
self.addMode("SEARCH_FORWARD", true);
|
||||||
|
self.addMode("SEARCH_BACKWARD", true);
|
||||||
|
self.addMode("MENU", true); // a popupmenu is active
|
||||||
|
self.addMode("LINE", true); // linewise visual mode
|
||||||
|
self.addMode("RECORDING", true);
|
||||||
|
self.addMode("PROMPT", true);
|
||||||
|
|
||||||
|
return self;
|
||||||
//}}}
|
//}}}
|
||||||
})(); //}}}
|
})(); //}}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user