1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 05:27:59 +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;
}
}, {

View File

@@ -12,17 +12,9 @@
<h1 tag="insert-mode insert mode-insert">Insert mode</h1>
<toc start="2"/>
<p>
<!-->
TODO: INTRODUCTORY TEXT...
</p>
<item>
<tags>t_i</tags>
<spec>t_i</spec>
<description short="true">
<p>Starts Insert mode in text areas when <o>insertmode</o> is not set.</p>
</description>
</item>
</-->
<h2 tag="ins-special-keys">Insert-mode special keys</h2>
@@ -41,8 +33,9 @@
<item>
<tags><![CDATA[i_<C-t>]]></tags>
<strut/>
<spec>&lt;C-t></spec>
<description short="true">
<description>
<p>
Enter Text Edit mode. This is useful for quick editing of text
fields with basic Vim-keys support. See also <o>insertmode</o>.
@@ -140,6 +133,14 @@
<h2 tag="text-edit-mode text-edit tedit-mode">Text Edit mode</h2>
<item>
<tags>t_i</tags>
<spec>t_i</spec>
<description short="true">
<p>Starts Insert mode in text areas when <o>insertmode</o> is not set.</p>
</description>
</item>
<item>
<tags><![CDATA[t_<C-i>]]></tags>
<spec>&lt;C-i></spec>
@@ -164,8 +165,9 @@
<item>
<tags><![CDATA[t_l t_<Right> t_<Space>]]></tags>
<strut/>
<spec><oa>count</oa>l</spec>
<description short="true">
<description>
<p>
Move the cursor <oa>count</oa> characters to the right.
</p>
@@ -511,6 +513,7 @@
<item>
<tags>t_y v_y</tags>
<spec>y<a>motion</a></spec>
<strut/>
<spec><a>Visual</a>y</spec>
<description short="true">
<p>
@@ -553,6 +556,7 @@
<item>
<tags>t_~</tags>
<strut/>
<spec>~</spec>
<description>
<p>