mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-26 10:45:45 +01:00
Fix some bugs.
This commit is contained in:
@@ -300,7 +300,7 @@ var Hints = Module("hints", {
|
|||||||
util.computedStyle(fragment).height; // Force application of binding.
|
util.computedStyle(fragment).height; // Force application of binding.
|
||||||
let container = doc.getAnonymousElementByAttribute(fragment, "anonid", "hints");
|
let container = doc.getAnonymousElementByAttribute(fragment, "anonid", "hints");
|
||||||
|
|
||||||
let baseNodeAbsolute = util.xmlToDom(<span highlight="Hint"/>, doc);
|
let baseNodeAbsolute = util.xmlToDom(<span highlight="Hint" style="display: none"/>, doc);
|
||||||
|
|
||||||
let mode = this._hintMode;
|
let mode = this._hintMode;
|
||||||
let res = util.evaluateXPath(mode.xpath, doc, null, true);
|
let res = util.evaluateXPath(mode.xpath, doc, null, true);
|
||||||
@@ -432,6 +432,7 @@ var Hints = Module("hints", {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
hint.imgSpan = util.xmlToDom(<span highlight="Hint" dactyl:hl="HintImage" xmlns:dactyl={NS}/>, doc);
|
hint.imgSpan = util.xmlToDom(<span highlight="Hint" dactyl:hl="HintImage" xmlns:dactyl={NS}/>, doc);
|
||||||
|
hint.imgSpan.style.display = "none";
|
||||||
hint.imgSpan.style.left = (rect.left + offsetX) + "px";
|
hint.imgSpan.style.left = (rect.left + offsetX) + "px";
|
||||||
hint.imgSpan.style.top = (rect.top + offsetY) + "px";
|
hint.imgSpan.style.top = (rect.top + offsetY) + "px";
|
||||||
hint.imgSpan.style.width = (rect.right - rect.left) + "px";
|
hint.imgSpan.style.width = (rect.right - rect.left) + "px";
|
||||||
|
|||||||
@@ -9,10 +9,17 @@ if (!JSMLoader)
|
|||||||
builtin: Components.utils.Sandbox(this),
|
builtin: Components.utils.Sandbox(this),
|
||||||
factories: [],
|
factories: [],
|
||||||
globals: {},
|
globals: {},
|
||||||
|
io: Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService),
|
||||||
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
|
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
|
||||||
stale: {},
|
stale: {},
|
||||||
|
getTarget: function getTarget(url) {
|
||||||
|
let chan = this.io.newChannel(url, null, null);
|
||||||
|
chan.cancel(Components.results.NS_BINDING_ABORTED);
|
||||||
|
return chan.name;
|
||||||
|
},
|
||||||
load: function load(url, target) {
|
load: function load(url, target) {
|
||||||
if (this.stale[url]) {
|
let stale = this.stale[url];
|
||||||
|
if (stale) {
|
||||||
delete this.stale[url];
|
delete this.stale[url];
|
||||||
let global = this.globals[url];
|
let global = this.globals[url];
|
||||||
|
|
||||||
@@ -28,9 +35,12 @@ if (!JSMLoader)
|
|||||||
Components.utils.reportError(e);
|
Components.utils.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
if (stale !== this.getTarget(url))
|
||||||
.getService(Components.interfaces.mozIJSSubScriptLoader)
|
delete this.globals[url];
|
||||||
.loadSubScript(url, global);
|
else
|
||||||
|
Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
|
.getService(Components.interfaces.mozIJSSubScriptLoader)
|
||||||
|
.loadSubScript(url, global);
|
||||||
}
|
}
|
||||||
Components.utils.import(url, target);
|
Components.utils.import(url, target);
|
||||||
},
|
},
|
||||||
@@ -40,7 +50,7 @@ if (!JSMLoader)
|
|||||||
},
|
},
|
||||||
purge: function purge() {
|
purge: function purge() {
|
||||||
for (let [url, global] in Iterator(this.globals))
|
for (let [url, global] in Iterator(this.globals))
|
||||||
this.stale[url] = true;
|
this.stale[url] = this.getTarget(url);
|
||||||
},
|
},
|
||||||
registerGlobal: function registerGlobal(uri, obj) {
|
registerGlobal: function registerGlobal(uri, obj) {
|
||||||
if (Cu.getGlobalForObject)
|
if (Cu.getGlobalForObject)
|
||||||
|
|||||||
@@ -221,12 +221,12 @@ var IO = Module("io", {
|
|||||||
newDir = newDir || "~";
|
newDir = newDir || "~";
|
||||||
|
|
||||||
if (newDir == "-") {
|
if (newDir == "-") {
|
||||||
dactyl.assert(this._oldcwd != null, "E186: No previous directory");
|
util.assert(this._oldcwd != null, "E186: No previous directory");
|
||||||
[this._cwd, this._oldcwd] = [this._oldcwd, this.cwd];
|
[this._cwd, this._oldcwd] = [this._oldcwd, this.cwd];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let dir = io.File(newDir);
|
let dir = io.File(newDir);
|
||||||
dactyl.assert(dir.exists() && dir.isDirectory(), "E344: Can't find directory " + dir.path.quote());
|
util.assert(dir.exists() && dir.isDirectory(), "E344: Can't find directory " + dir.path.quote());
|
||||||
dir.normalize();
|
dir.normalize();
|
||||||
[this._cwd, this._oldcwd] = [dir.path, this.cwd];
|
[this._cwd, this._oldcwd] = [dir.path, this.cwd];
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ var IO = Module("io", {
|
|||||||
file = this.pathSearch(program);
|
file = this.pathSearch(program);
|
||||||
|
|
||||||
if (!file || !file.exists()) {
|
if (!file || !file.exists()) {
|
||||||
dactyl.echoerr("Command not found: " + program);
|
util.dactyl.echoerr("Command not found: " + program);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,7 +576,7 @@ var IO = Module("io", {
|
|||||||
let lines = [cmd.serialize().map(commands.commandToString, cmd) for (cmd in commands.iterator()) if (cmd.serialize)];
|
let lines = [cmd.serialize().map(commands.commandToString, cmd) for (cmd in commands.iterator()) if (cmd.serialize)];
|
||||||
lines = array.flatten(lines);
|
lines = array.flatten(lines);
|
||||||
|
|
||||||
lines.unshift('"' + dactyl.version + "\n");
|
lines.unshift('"' + util.version + "\n");
|
||||||
lines.push("\n\" vim: set ft=" + config.name + ":");
|
lines.push("\n\" vim: set ft=" + config.name + ":");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user