diff --git a/common/content/buffer.js b/common/content/buffer.js index 537fc0b7..79a88f1e 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -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); diff --git a/common/content/commandline.js b/common/content/commandline.js index 454ed83d..dc532270 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -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, diff --git a/common/content/commands.js b/common/content/commands.js index ddb9d033..06995c8e 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -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; diff --git a/common/content/dactyl.js b/common/content/dactyl.js index fe8bf927..6a2bcaf5 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -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); diff --git a/common/content/editor.js b/common/content/editor.js index 05ea807c..e5721368 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -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? diff --git a/common/content/finder.js b/common/content/finder.js index 0ed495ec..34d95bc9 100644 --- a/common/content/finder.js +++ b/common/content/finder.js @@ -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); diff --git a/common/content/tabs.js b/common/content/tabs.js index 4f9118f6..087168f9 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -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; } }, { diff --git a/common/locale/en-US/insert.xml b/common/locale/en-US/insert.xml index af59eecc..228df1fc 100644 --- a/common/locale/en-US/insert.xml +++ b/common/locale/en-US/insert.xml @@ -12,17 +12,9 @@
+ TODO: INTRODUCTORY TEXT... -
- -Starts Insert mode in text areas when
Enter Text Edit mode. This is useful for quick editing of text
fields with basic Vim-keys support. See also
Starts Insert mode in text areas when
Move the cursor
@@ -553,6 +556,7 @@