1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 06:58:00 +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) { else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
// Workaround for bugs 591425 and 606877, dactyl bug #81 // Workaround for bugs 591425 and 606877, dactyl bug #81
config.browser.mCurrentBrowser.collapsed = false; config.browser.mCurrentBrowser.collapsed = false;
if (!dactyl.focusedElement)
dactyl.focusContent();
webProgress.DOMWindow.document.pageIsFullyLoaded = (status == 0 ? 1 : 2); webProgress.DOMWindow.document.pageIsFullyLoaded = (status == 0 ? 1 : 2);
statusline.updateUrl(); statusline.updateUrl();
@@ -1002,7 +1004,7 @@ const Buffer = Module("buffer", {
XPCOM([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), { XPCOM([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), {
init: function (doc, callback) { init: function (doc, callback) {
this.callback = callable(callback) ? 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 url = isString(doc) ? doc : doc.location.href;
let uri = util.newURI(url, charset); let uri = util.newURI(url, charset);

View File

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

View File

@@ -560,7 +560,7 @@ const Commands = Module("commands", {
*/ */
execute: function (string, tokens, silent, args, sourcing) { execute: function (string, tokens, silent, args, sourcing) {
io.withSavedValues(["readHeredoc", "sourcing"], function () { 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); this.sourcing = update({}, sourcing);
args = update({}, args || {}); args = update({}, args || {});
@@ -648,7 +648,8 @@ const Commands = Module("commands", {
if (io.sourcing) if (io.sourcing)
return { return {
__proto__: frame, __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 lineNumber: io.sourcing.line
}; };
return frame; return frame;

View File

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

View File

@@ -241,12 +241,12 @@ const Editor = Module("editor", {
return -1; 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 }); let args = options.get("editor").format({ file: path, line: line, column: column });
dactyl.assert(args.length >= 1, "No editor specified"); 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? // TODO: clean up with 2 functions for textboxes and currentEditor?

View File

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

View File

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

View File

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