1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 12:34:11 +01:00

Fix definition link for commands defined on the command-line.

This commit is contained in:
Kris Maglione
2010-12-18 18:56:17 -05:00
parent 08058d0e4d
commit 394420a9d1
8 changed files with 70 additions and 35 deletions

View File

@@ -258,6 +258,8 @@ const Buffer = Module("buffer", {
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
// Workaround for bugs 591425 and 606877, dactyl bug #81
config.browser.mCurrentBrowser.collapsed = false;
if (!dactyl.focusedElement)
dactyl.focusContent();
webProgress.DOMWindow.document.pageIsFullyLoaded = (status == 0 ? 1 : 2);
statusline.updateUrl();
@@ -1002,7 +1004,7 @@ const Buffer = Module("buffer", {
XPCOM([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), {
init: function (doc, callback) {
this.callback = callable(callback) ? callback :
function (file) editor.editFileExternally(file.path, callback);
function (file) editor.editFileExternally(file.path, callback, null, true);
let url = isString(doc) ? doc : doc.location.href;
let uri = util.newURI(url, charset);

View File

@@ -310,7 +310,7 @@ const CommandLine = Module("commandline", {
var readHeredoc = io.readHeredoc;
io.readHeredoc = commandline.readHeredoc;
commands.repeat = command;
dactyl.execute(command);
commands.execute(command);
}
finally {
io.readHeredoc = readHeredoc;
@@ -1634,7 +1634,7 @@ const CommandLine = Module("commandline", {
commands.add(["sil[ent]"],
"Run a command silently",
function (args) {
commandline.runSilently(function () dactyl.execute(args[0] || "", null, true));
commandline.runSilently(function () commands.execute(args[0] || "", null, true));
}, {
completer: function (context) completion.ex(context),
literal: 0,

View File

@@ -560,7 +560,7 @@ const Commands = Module("commands", {
*/
execute: function (string, tokens, silent, args, sourcing) {
io.withSavedValues(["readHeredoc", "sourcing"], function () {
sourcing = sourcing || { file: "[Command Line]", line: 1 };
sourcing = sourcing || this.sourcing || { file: "[Command Line]", line: 1 };
this.sourcing = update({}, sourcing);
args = update({}, args || {});
@@ -648,7 +648,8 @@ const Commands = Module("commands", {
if (io.sourcing)
return {
__proto__: frame,
filename: services.io.newFileURI(File(io.sourcing.file)).spec,
filename: io.sourcing.file[0] == "[" ? io.sourcing.file :
services.io.newFileURI(File(io.sourcing.file)).spec,
lineNumber: io.sourcing.line
};
return frame;

View File

@@ -1846,7 +1846,7 @@ const Dactyl = Module("dactyl", {
args = args[0] || "";
if (args[0] == ":")
var method = function () dactyl.execute(args, null, true);
var method = function () commands.execute(args, null, true);
else
method = dactyl.userFunc(args);

View File

@@ -241,12 +241,12 @@ const Editor = Module("editor", {
return -1;
},
editFileExternally: function (path, line, column) {
editFileExternally: function (path, line, column, async) {
let args = options.get("editor").format({ file: path, line: line, column: column });
dactyl.assert(args.length >= 1, "No editor specified");
io.run(io.expandPath(args.shift()), args, true);
io.run(io.expandPath(args.shift()), args, !async);
},
// TODO: clean up with 2 functions for textboxes and currentEditor?

View File

@@ -311,9 +311,16 @@ const RangeFind = Class("RangeFind", {
this.range.descroll();
},
compareRanges: function (r1, r2)
this.backward ? r1.compareBoundaryPoints(r1.END_TO_START, r2)
: -r1.compareBoundaryPoints(r1.START_TO_END, r2),
compareRanges: function (r1, r2) {
try {
return this.backward ? r1.compareBoundaryPoints(r1.END_TO_START, r2)
: -r1.compareBoundaryPoints(r1.START_TO_END, r2);
}
catch (e) {
util.reportError(e);
return 0;
}
},
findRange: function (range) {
let doc = range.startContainer.ownerDocument;
@@ -603,9 +610,16 @@ const RangeFind = Class("RangeFind", {
this.save();
},
intersects: function (range)
this.range.compareBoundaryPoints(range.START_TO_END, range) >= 0 &&
this.range.compareBoundaryPoints(range.END_TO_START, range) <= 0,
intersects: function (range) {
try {
return this.range.compareBoundaryPoints(range.START_TO_END, range) >= 0 &&
this.range.compareBoundaryPoints(range.END_TO_START, range) <= 0;
}
catch (e) {
dactyl.reportError(e, true);
return false;
}
},
save: function () {
this.scroll = Point(this.window.pageXOffset, this.window.pageYOffset);
@@ -639,12 +653,26 @@ const RangeFind = Class("RangeFind", {
}
}
}),
contains: function (range, r)
range.compareBoundaryPoints(range.START_TO_END, r) >= 0 &&
range.compareBoundaryPoints(range.END_TO_START, r) <= 0,
intersects: function (range, r)
r.compareBoundaryPoints(range.START_TO_END, range) >= 0 &&
r.compareBoundaryPoints(range.END_TO_START, range) <= 0,
contains: function (range, r) {
try {
return range.compareBoundaryPoints(range.START_TO_END, r) >= 0 &&
range.compareBoundaryPoints(range.END_TO_START, r) <= 0;
}
catch (e) {
dactyl.reportError(e, true);
return false;
}
},
intersects: function (range, r) {
try {
return r.compareBoundaryPoints(range.START_TO_END, range) >= 0 &&
r.compareBoundaryPoints(range.END_TO_START, range) <= 0;
}
catch (e) {
dactyl.reportError(e, true);
return false;
}
},
endpoint: function (range, before) {
range = range.cloneRange();
range.collapse(before);

View File

@@ -552,7 +552,7 @@ const Tabs = Module("tabs", {
let alternate = tabs.alternate;
try {
dactyl.execute(args[0] || "", null, true);
commands.execute(args[0] || "", null, true);
}
finally {
tabs.updateSelectionHistory([tabs.getTab(), alternate]);
@@ -569,7 +569,7 @@ const Tabs = Module("tabs", {
function (args) {
dactyl.withSavedValues(["forceNewTab"], function () {
this.forceNewTab = true;
this.execute(args[0] || "", null, true);
commands.execute(args[0] || "", null, true);
});
}, {
argCount: "+",
@@ -583,7 +583,7 @@ const Tabs = Module("tabs", {
function (args) {
for (let tab in values(tabs.visibleTabs)) {
tabs.select(tab);
if (!dactyl.execute(args[0] || "", null, true))
if (!commands.execute(args[0] || "", null, true))
break;
}
}, {