mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 23:07:59 +01:00
Decode URLs in the completion list against my better judgment. Get rid of bloody newlines in strict mode lambdas.
This commit is contained in:
@@ -38,7 +38,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
get format() ({
|
get format() ({
|
||||||
anchored: false,
|
anchored: false,
|
||||||
title: ["URL", "Info"],
|
title: ["URL", "Info"],
|
||||||
keys: { text: "url", description: "title", icon: "icon", extra: "extra", tags: "tags" },
|
keys: { text: "url", description: "title", icon: "icon", extra: "extra", tags: "tags", isURI: function () true },
|
||||||
process: [template.icon, template.bookmarkDescription]
|
process: [template.icon, template.bookmarkDescription]
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -1343,8 +1343,8 @@ var CommandLine = Module("commandline", {
|
|||||||
arg = dactyl.userEval(arg);
|
arg = dactyl.userEval(arg);
|
||||||
if (isObject(arg))
|
if (isObject(arg))
|
||||||
arg = util.objectToString(arg, useColor);
|
arg = util.objectToString(arg, useColor);
|
||||||
else
|
else if (!isString(arg) && useColor)
|
||||||
arg = String(arg);
|
arg = template.highlight(arg);
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
this.processor = Array.slice(this.process);
|
this.processor = Array.slice(this.process);
|
||||||
if (!this.anchored)
|
if (!this.anchored)
|
||||||
this.processor[0] = function (item, text) self.process[0].call(self, item,
|
this.processor[0] = function (item, text) self.process[0].call(self, item,
|
||||||
template.highlightFilter(item.text, self.filter));
|
template.highlightFilter(item.text, self.filter, null, item.isURI));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Item prototypes
|
// Item prototypes
|
||||||
|
|||||||
@@ -273,11 +273,11 @@ var Template = Module("Template", {
|
|||||||
case "boolean":
|
case "boolean":
|
||||||
return <span highlight="Boolean">{str}</span>;
|
return <span highlight="Boolean">{str}</span>;
|
||||||
case "function":
|
case "function":
|
||||||
// Vim generally doesn't like /foo*/, because */ looks like a comment terminator.
|
str = str.replace("/* use strict */ \n", "/* use strict */ ");
|
||||||
// Using /foo*(:?)/ instead.
|
|
||||||
if (processStrings)
|
if (processStrings)
|
||||||
return <span highlight="Function">{str.replace(/\{(.|\n)*(?:)/g, "{ ... }")}</span>;
|
return <span highlight="Function">{str.replace(/\{(.|\n)*(?:)/g, "{ ... }")}</span>;
|
||||||
<>}</>; /* Vim */
|
<>}</>; /* Vim */
|
||||||
|
arg = String(arg).replace("/* use strict */ \n", "/* use strict */ ");
|
||||||
return <>{arg}</>;
|
return <>{arg}</>;
|
||||||
case "undefined":
|
case "undefined":
|
||||||
return <span highlight="Null">{arg}</span>;
|
return <span highlight="Null">{arg}</span>;
|
||||||
@@ -302,7 +302,10 @@ var Template = Module("Template", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
highlightFilter: function highlightFilter(str, filter, highlight) {
|
highlightFilter: function highlightFilter(str, filter, highlight, isURI) {
|
||||||
|
if (isURI)
|
||||||
|
str = util.losslessDecodeURI(str);
|
||||||
|
|
||||||
return this.highlightSubstrings(str, (function () {
|
return this.highlightSubstrings(str, (function () {
|
||||||
if (filter.length == 0)
|
if (filter.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1094,7 +1094,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
catch (e) {
|
catch (e) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}, this).join("%25");
|
}, this).join("%25").replace(/[\s.,>)]$/, encodeURIComponent);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user