mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-19 22:27:58 +01:00
Add n_s and n_S.
This commit is contained in:
@@ -220,6 +220,14 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
"Open one or more URLs, based on current location",
|
||||
function () { CommandExMode().open("open " + decode(buffer.uri.spec)); });
|
||||
|
||||
mappings.add([modes.NORMAL], ["s"],
|
||||
"Open a search prompt",
|
||||
function () { CommandExMode().open("open " + options["defsearch"] + " "); });
|
||||
|
||||
mappings.add([modes.NORMAL], ["S"],
|
||||
"Open a search prompt for a new tab",
|
||||
function () { CommandExMode().open("tabopen " + options["defsearch"] + " "); });
|
||||
|
||||
mappings.add([modes.NORMAL], ["t"],
|
||||
"Open one or more URLs in a new tab",
|
||||
function () { CommandExMode().open("tabopen "); });
|
||||
|
||||
@@ -21,19 +21,18 @@ var History = Module("history", {
|
||||
for (let [k, v] in Iterator(filter))
|
||||
query[k] = v;
|
||||
|
||||
order = order || "+date";
|
||||
dactyl.assert((order = /^([+-])(.+)/.exec(order)) &&
|
||||
(order = "SORT_BY_" + order[2].toUpperCase() + "_" +
|
||||
(order[1] == "+" ? "ASCENDING" : "DESCENDING")) &&
|
||||
order in options,
|
||||
_("error.invalidSort", order));
|
||||
let _order = /^([+-])(.+)/.exec(order || "+date");
|
||||
dactyl.assert(_order, _("error.invalidSort", order));
|
||||
|
||||
options.sortingMode = options[order];
|
||||
_order = "SORT_BY_" + _order[2].toUpperCase() + "_" +
|
||||
(_order[1] == "+" ? "ASCENDING" : "DESCENDING");
|
||||
dactyl.assert(_order in options, _("error.invalidSort", order));
|
||||
|
||||
options.sortingMode = options[_order];
|
||||
options.resultType = options.RESULTS_AS_URI;
|
||||
if (maxItems > 0)
|
||||
options.maxResults = maxItems;
|
||||
|
||||
// execute the query
|
||||
let root = services.history.executeQuery(query, options).root;
|
||||
root.containerOpen = true;
|
||||
let items = iter(util.range(0, root.childCount)).map(function (i) {
|
||||
@@ -44,7 +43,7 @@ var History = Module("history", {
|
||||
icon: node.icon ? node.icon : DEFAULT_FAVICON
|
||||
};
|
||||
}).toArray();
|
||||
root.containerOpen = false; // close a container after using it!
|
||||
root.containerOpen = false;
|
||||
|
||||
return items;
|
||||
},
|
||||
@@ -58,12 +57,11 @@ var History = Module("history", {
|
||||
obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val) });
|
||||
obj.__iterator__ = function () array.iterItems(this);
|
||||
|
||||
for (let i in util.range(0, sh.count)) {
|
||||
obj[i] = update(Object.create(sh.getEntryAtIndex(i, false)),
|
||||
{ index: i });
|
||||
memoize(obj[i], "icon",
|
||||
function () services.favicon.getFaviconImageForPage(this.URI).spec);
|
||||
}
|
||||
for (let item in iter(sh.SHistoryEnumerator, Ci.nsIHistoryEntry))
|
||||
obj.push(update(Object.create(item), {
|
||||
index: obj.length,
|
||||
icon: Class.memoize(function () services.favicon.getFaviconImageForPage(this.URI).spec)
|
||||
}));
|
||||
return obj;
|
||||
},
|
||||
|
||||
@@ -87,7 +85,7 @@ var History = Module("history", {
|
||||
try {
|
||||
sh.index = Math.constrain(sh.index + steps, 0, sh.length - 1);
|
||||
}
|
||||
catch (e) {} // We get NS_ERROR_FILE_NOT_FOUND if files in history don't exist
|
||||
catch (e if e.result == Cr.NS_ERROR_FILE_NOT_FOUND) {}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,6 +86,16 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>O</tags>
|
||||
<spec>O</spec>
|
||||
<description short="true">
|
||||
<p>
|
||||
Open an <ex>:open</ex> prompt followed by the current URL.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>T</tags>
|
||||
<spec>T</spec>
|
||||
@@ -96,6 +106,22 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>s</tags>
|
||||
<spec>s</spec>
|
||||
<description short="true">
|
||||
<p>Open a search prompt.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>S</tags>
|
||||
<spec>S</spec>
|
||||
<description short="true">
|
||||
<p>Open a search prompt for a new tab.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>:tabdu :tabduplicate</tags>
|
||||
<spec>:<oa>count</oa>tabdu<oa>plicate</oa><oa>!</oa></spec>
|
||||
@@ -108,16 +134,6 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>O</tags>
|
||||
<spec>O</spec>
|
||||
<description short="true">
|
||||
<p>
|
||||
Open an <ex>:open</ex> prompt followed by the current URL.
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<tags>w :winopen :wopen</tags>
|
||||
<spec>:wino<oa>pen</oa><oa>!</oa> <oa>args</oa></spec>
|
||||
|
||||
@@ -1297,9 +1297,13 @@ function octal(decimal) parseInt(decimal, 8);
|
||||
* function.
|
||||
*
|
||||
* @param {object} obj
|
||||
* @param {nsIJSIID} iface The interface to which to query all elements.
|
||||
* @returns {Generator}
|
||||
*/
|
||||
function iter(obj) {
|
||||
function iter(obj, iface) {
|
||||
if (arguments.length == 2 && iface instanceof Ci.nsIJSIID)
|
||||
return iter(obj).map(function (item) item.QueryInterface(iface));
|
||||
|
||||
let args = arguments;
|
||||
let res = Iterator(obj);
|
||||
|
||||
|
||||
@@ -369,20 +369,18 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
prefToArg: function (pref) pref.replace(/.*\./, "").toLowerCase(),
|
||||
|
||||
iterCookies: function iterCookies(host) {
|
||||
for (let c in iter(services.cookies)) {
|
||||
c.QueryInterface(Ci.nsICookie2);
|
||||
if (!host || util.isSubdomain(c.rawHost, host) || c.host[0] == "." && c.host.length < host.length && host.indexOf(c.host) == host.length - c.host.length)
|
||||
for (let c in iter(services.cookies, Ci.nsICookie2))
|
||||
if (!host || util.isSubdomain(c.rawHost, host) ||
|
||||
c.host[0] == "." && c.host.length < host.length
|
||||
&& host.indexOf(c.host) == host.length - c.host.length)
|
||||
yield c;
|
||||
}
|
||||
|
||||
},
|
||||
iterPermissions: function iterPermissions(host) {
|
||||
for (let p in iter(services.permissions)) {
|
||||
p.QueryInterface(Ci.nsIPermission);
|
||||
for (let p in iter(services.permissions, Ci.nsIPermission))
|
||||
if (!host || util.isSubdomain(p.host, host))
|
||||
yield p;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
load: function (dactyl, modules, window) {
|
||||
if (!sanitizer.firstRun++ && sanitizer.runAtShutdown && !sanitizer.ranAtShutdown)
|
||||
@@ -390,16 +388,18 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
sanitizer.ranAtShutdown = false;
|
||||
},
|
||||
autocommands: function (dactyl, modules, window) {
|
||||
const { autocommands } = modules;
|
||||
|
||||
storage.addObserver("private-mode",
|
||||
function (key, event, value) {
|
||||
modules.autocommands.trigger("PrivateMode", { state: value });
|
||||
autocommands.trigger("PrivateMode", { state: value });
|
||||
}, window);
|
||||
storage.addObserver("sanitizer",
|
||||
function (key, event, value) {
|
||||
if (event == "domain")
|
||||
modules.autocommands.trigger("SanitizeDomain", { domain: value });
|
||||
autocommands.trigger("SanitizeDomain", { domain: value });
|
||||
else if (!value[1])
|
||||
modules.autocommands.trigger("Sanitize", { name: event.substr("clear-".length), domain: value[1] });
|
||||
autocommands.trigger("Sanitize", { name: event.substr("clear-".length), domain: value[1] });
|
||||
}, window);
|
||||
},
|
||||
commands: function (dactyl, modules, window) {
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
- It's now possible to map keys in many more modes, including
|
||||
Hint, Multi-line Output, and Menu. [b4]
|
||||
- <C-o> and <C-i> now behave more like Vim. [b8]
|
||||
- Add n_s and n_S. [b8]
|
||||
- Added Operator mode for motion maps, per Vim. [b8]
|
||||
- Added site-specific mapping groups and related command
|
||||
changes. [b6]
|
||||
|
||||
Reference in New Issue
Block a user