mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 16:47:58 +01:00
Don't strip spaces from URLs in :open (grr!), poke 'urlsep' value a bit, moderately decode URLs in O/T/W.
This commit is contained in:
@@ -200,9 +200,13 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
["o"], "Open one or more URLs",
|
["o"], "Open one or more URLs",
|
||||||
function () { CommandExMode().open("open "); });
|
function () { CommandExMode().open("open "); });
|
||||||
|
|
||||||
|
function decode(uri) statusline.losslessDecodeURI(uri)
|
||||||
|
.replace(/%20(?!(?:%20)*$)/g, " ")
|
||||||
|
.replace(RegExp(options["urlseparator"], "g"), encodeURIComponent);
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["O"],
|
mappings.add([modes.NORMAL], ["O"],
|
||||||
"Open one or more URLs, based on current location",
|
"Open one or more URLs, based on current location",
|
||||||
function () { CommandExMode().open("open " + buffer.uri.spec); });
|
function () { CommandExMode().open("open " + decode(buffer.uri.spec)); });
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["t"],
|
mappings.add([modes.NORMAL], ["t"],
|
||||||
"Open one or more URLs in a new tab",
|
"Open one or more URLs in a new tab",
|
||||||
@@ -210,7 +214,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
|
|
||||||
mappings.add([modes.NORMAL], ["T"],
|
mappings.add([modes.NORMAL], ["T"],
|
||||||
"Open one or more URLs in a new tab, based on current location",
|
"Open one or more URLs in a new tab, based on current location",
|
||||||
function () { CommandExMode().open("tabopen " + buffer.uri.spec); });
|
function () { CommandExMode().open("tabopen " + decode(buffer.uri.spec)); });
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["w"],
|
mappings.add([modes.NORMAL], ["w"],
|
||||||
"Open one or more URLs in a new window",
|
"Open one or more URLs in a new window",
|
||||||
@@ -218,7 +222,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
|
|
||||||
mappings.add([modes.NORMAL], ["W"],
|
mappings.add([modes.NORMAL], ["W"],
|
||||||
"Open one or more URLs in a new window, based on current location",
|
"Open one or more URLs in a new window, based on current location",
|
||||||
function () { CommandExMode().open("winopen " + buffer.uri.spec); });
|
function () { CommandExMode().open("winopen " + decode(buffer.uri.spec)); });
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["~"],
|
mappings.add([modes.NORMAL], ["~"],
|
||||||
"Open home directory",
|
"Open home directory",
|
||||||
|
|||||||
@@ -1752,7 +1752,7 @@ var Buffer = Module("buffer", {
|
|||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
let url = dactyl.clipboardRead();
|
||||||
dactyl.assert(url, _("error.clipboardEmpty"));
|
dactyl.assert(url, _("error.clipboardEmpty"));
|
||||||
dactyl.open(url);
|
dactyl.open(url.replace(/\s+/g, ""));
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["P", "<tab-open-clipboard-url>"],
|
mappings.add([modes.NORMAL], ["P", "<tab-open-clipboard-url>"],
|
||||||
@@ -1760,7 +1760,7 @@ var Buffer = Module("buffer", {
|
|||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
let url = dactyl.clipboardRead();
|
||||||
dactyl.assert(url, _("error.clipboardEmpty"));
|
dactyl.assert(url, _("error.clipboardEmpty"));
|
||||||
dactyl.open(url, { from: "paste", where: dactyl.NEW_TAB });
|
dactyl.open(url.replace(/\s+/g, ""), { from: "paste", where: dactyl.NEW_TAB });
|
||||||
});
|
});
|
||||||
|
|
||||||
// reloading
|
// reloading
|
||||||
|
|||||||
@@ -1307,7 +1307,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
// If it starts with a valid protocol, pass it through.
|
// If it starts with a valid protocol, pass it through.
|
||||||
let proto = /^([-\w]+):/.exec(url);
|
let proto = /^([-\w]+):/.exec(url);
|
||||||
if (proto && "@mozilla.org/network/protocol;1?name=" + proto[1] in Cc)
|
if (proto && "@mozilla.org/network/protocol;1?name=" + proto[1] in Cc)
|
||||||
return url.replace(/\s+/g, "");
|
return url;
|
||||||
|
|
||||||
// Check for a matching search keyword.
|
// Check for a matching search keyword.
|
||||||
let searchURL = this.has("bookmarks") && bookmarks.getSearchURL(url, false);
|
let searchURL = this.has("bookmarks") && bookmarks.getSearchURL(url, false);
|
||||||
@@ -1681,7 +1681,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
options.add(["urlseparator", "urlsep", "us"],
|
options.add(["urlseparator", "urlsep", "us"],
|
||||||
"The regular expression used to separate multiple URLs in :open and friends",
|
"The regular expression used to separate multiple URLs in :open and friends",
|
||||||
"string", "\\|",
|
"string", " \\| ",
|
||||||
{ validator: function (value) RegExp(value) });
|
{ validator: function (value) RegExp(value) });
|
||||||
|
|
||||||
options.add(["verbose", "vbs"],
|
options.add(["verbose", "vbs"],
|
||||||
|
|||||||
Reference in New Issue
Block a user