mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 17:54:13 +01:00
Fix yanking bug, and less sucky literal() parsing.
--HG-- extra : rebase_source : 94698268ac8c138de45088f77ecb8bffa5169da0
This commit is contained in:
@@ -150,19 +150,24 @@ this.lazyRequire("services", ["services"]);
|
|||||||
this.lazyRequire("storage", ["File"]);
|
this.lazyRequire("storage", ["File"]);
|
||||||
this.lazyRequire("util", ["FailedAssertion", "util"]);
|
this.lazyRequire("util", ["FailedAssertion", "util"]);
|
||||||
|
|
||||||
|
literal.files = {};
|
||||||
|
literal.locations = {};
|
||||||
function literal(/* comment */) {
|
function literal(/* comment */) {
|
||||||
let { caller } = Components.stack;
|
let { caller } = Components.stack;
|
||||||
while (caller && caller.language != 2)
|
while (caller && caller.language != 2)
|
||||||
caller = caller.caller;
|
caller = caller.caller;
|
||||||
|
|
||||||
let file = caller.filename.replace(/.* -> /, "");
|
let file = caller.filename.replace(/.* -> /, "");
|
||||||
let key = "literal:" + file + ":" + caller.line;
|
let key = "literal:" + file + ":" + caller.lineNumber;
|
||||||
|
if (Set.has(literal.locations, key))
|
||||||
|
return literal.locations[key];
|
||||||
|
|
||||||
let source = File.readURL(file);
|
let source = literal.files[file] || File.readURL(file);
|
||||||
|
literal.files[file] = source;
|
||||||
|
|
||||||
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
|
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
|
||||||
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
|
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
|
||||||
return match[1];
|
return literal.locations[key] = match[1];
|
||||||
|
|
||||||
// Later...
|
// Later...
|
||||||
return cache.get(key, function () {
|
return cache.get(key, function () {
|
||||||
|
|||||||
@@ -644,9 +644,10 @@ var Buffer = Module("Buffer", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let link = DOM("link[href][rev=canonical], \
|
let link = DOM("link[href][rev=canonical], \
|
||||||
link[href][rel=shortlink]", doc);
|
link[href][rel=shortlink]", doc)
|
||||||
if (link.length)
|
.attr("href");
|
||||||
return hashify(link.attr("href"));
|
if (link)
|
||||||
|
return hashify(link);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<em:targetApplication>
|
<em:targetApplication>
|
||||||
<Description
|
<Description
|
||||||
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
||||||
em:minVersion="24.0"
|
em:minVersion="22.0"
|
||||||
em:maxVersion="25.*"/>
|
em:maxVersion="25.*"/>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
</Description>
|
</Description>
|
||||||
|
|||||||
Reference in New Issue
Block a user