From 2c3fd51812a3f3626f519aa7bd6b4b22e031a666 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 27 Jan 2011 18:38:08 +1100 Subject: [PATCH 1/2] Restore the repeat.xml help file. --HG-- extra : rebase_source : 7647d2e583fe2ed05c693a1524ff6e54105c3faf --- common/locale/en-US/repeat.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/locale/en-US/repeat.xml b/common/locale/en-US/repeat.xml index d9470eff..56aab737 100644 --- a/common/locale/en-US/repeat.xml +++ b/common/locale/en-US/repeat.xml @@ -109,7 +109,7 @@

- s + s]]> count<m>s From d16c0b0d06a5a4c308a03928328ba504a399ecd9 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 27 Jan 2011 15:12:33 -0500 Subject: [PATCH 2/2] Back out most of the changes accidentally merged from key-processing. --HG-- extra : rebase_source : a00510584f7e13917f8496e15b7dd36852d98ea7 --- common/content/bookmarks.js | 10 +- common/content/browser.js | 14 +- common/content/buffer.js | 128 +- common/content/commandline.js | 996 ++++++++----- common/content/dactyl.js | 8 +- common/content/events.js | 230 ++- common/content/hints.js | 87 +- common/content/mappings.js | 16 +- common/content/modes.js | 70 +- common/content/mow.js | 358 ----- common/content/tabs.js | 2 +- common/locale/en-US/browsing.xml | 12 +- common/locale/en-US/buffer.xml | 60 +- common/locale/en-US/map.xml | 8 - common/locale/en-US/repeat.xml | 39 +- common/modules/config.jsm | 3 - common/modules/finder.jsm | 61 +- common/modules/io.jsm | 31 - common/modules/overlay.jsm | 9 +- common/tests/functional/README | 1 + common/tests/functional/dactyl.js | 140 ++ common/tests/functional/data/find.html | 13 + .../tests/functional/shared-modules/addons.js | 1284 +++++++++++++++++ .../functional/shared-modules/dom-utils.js | 685 +++++++++ .../functional/shared-modules/downloads.js | 411 ++++++ .../functional/shared-modules/localization.js | 307 ++++ .../functional/shared-modules/modal-dialog.js | 236 +++ .../functional/shared-modules/performance.js | 208 +++ .../tests/functional/shared-modules/places.js | 192 +++ .../tests/functional/shared-modules/prefs.js | 384 +++++ .../shared-modules/private-browsing.js | 237 +++ .../functional/shared-modules/readme.txt | 10 + .../functional/shared-modules/screenshot.js | 131 ++ .../tests/functional/shared-modules/search.js | 836 +++++++++++ .../functional/shared-modules/sessionstore.js | 318 ++++ .../shared-modules/software-update.js | 530 +++++++ .../tests/functional/shared-modules/tabs.js | 503 +++++++ .../functional/shared-modules/tabview.js | 629 ++++++++ .../functional/shared-modules/toolbars.js | 509 +++++++ .../tests/functional/shared-modules/utils.js | 445 ++++++ .../functional/shared-modules/widgets.js | 82 ++ common/tests/functional/testAboutPage.js | 18 + common/tests/functional/testEchoCommands.js | 69 + common/tests/functional/testFindCommands.js | 42 + common/tests/functional/testHelpCommands.js | 62 + common/tests/functional/testShellCommands.js | 33 + common/tests/functional/testVersionCommand.js | 34 + 47 files changed, 9350 insertions(+), 1141 deletions(-) delete mode 100644 common/content/mow.js create mode 100644 common/tests/functional/README create mode 100644 common/tests/functional/dactyl.js create mode 100644 common/tests/functional/data/find.html create mode 100644 common/tests/functional/shared-modules/addons.js create mode 100644 common/tests/functional/shared-modules/dom-utils.js create mode 100644 common/tests/functional/shared-modules/downloads.js create mode 100644 common/tests/functional/shared-modules/localization.js create mode 100644 common/tests/functional/shared-modules/modal-dialog.js create mode 100644 common/tests/functional/shared-modules/performance.js create mode 100644 common/tests/functional/shared-modules/places.js create mode 100644 common/tests/functional/shared-modules/prefs.js create mode 100644 common/tests/functional/shared-modules/private-browsing.js create mode 100644 common/tests/functional/shared-modules/readme.txt create mode 100644 common/tests/functional/shared-modules/screenshot.js create mode 100644 common/tests/functional/shared-modules/search.js create mode 100644 common/tests/functional/shared-modules/sessionstore.js create mode 100644 common/tests/functional/shared-modules/software-update.js create mode 100644 common/tests/functional/shared-modules/tabs.js create mode 100644 common/tests/functional/shared-modules/tabview.js create mode 100644 common/tests/functional/shared-modules/toolbars.js create mode 100644 common/tests/functional/shared-modules/utils.js create mode 100644 common/tests/functional/shared-modules/widgets.js create mode 100644 common/tests/functional/testAboutPage.js create mode 100644 common/tests/functional/testEchoCommands.js create mode 100644 common/tests/functional/testFindCommands.js create mode 100644 common/tests/functional/testHelpCommands.js create mode 100644 common/tests/functional/testShellCommands.js create mode 100644 common/tests/functional/testVersionCommand.js diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index fb936e3b..8b741d9a 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -115,8 +115,9 @@ var Bookmarks = Module("bookmarks", { if (charset != null && charset !== "UTF-8") options["-charset"] = charset; - CommandExMode().open( - commands.commandToString({ command: "bmark", options: options, arguments: [url] }) + " -keyword "); + commandline.open(":", + commands.commandToString({ command: "bmark", options: options, arguments: [url] }) + " -keyword ", + modes.EX); }, /** @@ -581,8 +582,9 @@ var Bookmarks = Module("bookmarks", { options["-charset"] = content.document.characterSet; } - CommandExMode().open( - commands.commandToString({ command: "bmark", options: options, arguments: [buffer.uri.spec] })); + commandline.open(":", + commands.commandToString({ command: "bmark", options: options, arguments: [buffer.uri.spec] }), + modes.EX); }); mappings.add(myModes, ["A"], diff --git a/common/content/browser.js b/common/content/browser.js index ac647fee..1be4fcfb 100644 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -65,33 +65,33 @@ var Browser = Module("browser", { mappings: function () { mappings.add([modes.NORMAL], - ["y", ""], "Yank current location to the clipboard", + ["y"], "Yank current location to the clipboard", function () { dactyl.clipboardWrite(buffer.uri.spec, true); }); // opening websites mappings.add([modes.NORMAL], ["o"], "Open one or more URLs", - function () { CommandExMode().open("open "); }); + function () { commandline.open(":", "open ", modes.EX); }); mappings.add([modes.NORMAL], ["O"], "Open one or more URLs, based on current location", - function () { CommandExMode().open("open " + buffer.uri.spec); }); + function () { commandline.open(":", "open " + buffer.uri.spec, modes.EX); }); mappings.add([modes.NORMAL], ["t"], "Open one or more URLs in a new tab", - function () { CommandExMode().open("tabopen "); }); + function () { commandline.open(":", "tabopen ", modes.EX); }); mappings.add([modes.NORMAL], ["T"], "Open one or more URLs in a new tab, based on current location", - function () { CommandExMode().open("tabopen " + buffer.uri.spec); }); + function () { commandline.open(":", "tabopen " + buffer.uri.spec, modes.EX); }); mappings.add([modes.NORMAL], ["w"], "Open one or more URLs in a new window", - function () { CommandExMode().open("winopen "); }); + function () { commandline.open(":", "winopen ", modes.EX); }); mappings.add([modes.NORMAL], ["W"], "Open one or more URLs in a new window, based on current location", - function () { CommandExMode().open("winopen " + buffer.uri.spec); }); + function () { commandline.open(":", "winopen " + buffer.uri.spec, modes.EX); }); mappings.add([modes.NORMAL], [""], "Increment last number in URL", diff --git a/common/content/buffer.js b/common/content/buffer.js index df6e2329..2cdbae5b 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -766,25 +766,25 @@ var Buffer = Module("buffer", { try { window.urlSecurityCheck(uri.spec, doc.nodePrincipal); - io.CommandFileMode("Save link: ", { - onSubmit: function (path) { - let file = io.File(path); - if (file.exists() && file.isDirectory()) - file.append(buffer.getDefaultNames(elem)[0][0]); + commandline.input("Save link: ", function (path) { + let file = io.File(path); + if (file.exists() && file.isDirectory()) + file.append(buffer.getDefaultNames(elem)[0][0]); - try { - if (!file.exists()) - file.create(File.NORMAL_FILE_TYPE, octal(644)); - } - catch (e) { - util.assert(false, "Invalid destination: " + e.name); - } + try { + if (!file.exists()) + file.create(File.NORMAL_FILE_TYPE, octal(644)); + } + catch (e) { + util.assert(false, "Invalid destination: " + e.name); + } - buffer.saveURI(uri, file); - }, - - completer: function (context) completion.savePage(context, elem) - }).open(); + buffer.saveURI(uri, file); + }, { + autocomplete: true, + completer: function (context) completion.savePage(context, elem), + history: "file" + }); } catch (e) { dactyl.echoerr(e); @@ -1360,15 +1360,17 @@ var Buffer = Module("buffer", { }, openUploadPrompt: function openUploadPrompt(elem) { - io.CommandFileMode("Upload file: ", { - onSubmit: function (path) { - let file = io.File(path); - dactyl.assert(file.exists()); + commandline.input("Upload file: ", function (path) { + let file = io.File(path); + dactyl.assert(file.exists()); - elem.value = file.path; - events.dispatch(elem, events.create(elem.ownerDocument, "change", {})); - } - }).open(elem.value); + elem.value = file.path; + events.dispatch(elem, events.create(elem.ownerDocument, "change", {})); + }, { + completer: function (context) completion.file(context), + default: elem.value, + history: "file" + }); } }, { commands: function () { @@ -1528,8 +1530,7 @@ var Buffer = Module("buffer", { if (/^>>/.test(context.filter)) context.advance(/^>>\s*/.exec(context.filter)[0].length); - completion.savePage(context, content.document); - context.fork("file", 0, completion, "file"); + return completion.savePage(context, content.document); }, literal: 0 }); @@ -1641,6 +1642,7 @@ var Buffer = Module("buffer", { this, function (context) { context.completions = buffer.getDefaultNames(node); }); + return context.fork("files", 0, completion, "file"); }; }, events: function () { @@ -1651,7 +1653,7 @@ var Buffer = Module("buffer", { mappings: function () { var myModes = config.browserModes; - mappings.add(myModes, [".", ""], + mappings.add(myModes, ["."], "Repeat the last key event", function (args) { if (mappings.repeat) { @@ -1670,31 +1672,31 @@ var Buffer = Module("buffer", { function () { ex.stop(); }); // scrolling - mappings.add(myModes, ["j", "", "", ""], + mappings.add(myModes, ["j", "", ""], "Scroll document down", function (args) { buffer.scrollVertical("lines", Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, ["k", "", "", ""], + mappings.add(myModes, ["k", "", ""], "Scroll document up", function (args) { buffer.scrollVertical("lines", -Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, dactyl.has("mail") ? ["h", ""] : ["h", "", ""], + mappings.add(myModes, dactyl.has("mail") ? ["h"] : ["h", ""], "Scroll document to the left", function (args) { buffer.scrollHorizontal("columns", -Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, dactyl.has("mail") ? ["l", ""] : ["l", "", ""], + mappings.add(myModes, dactyl.has("mail") ? ["l"] : ["l", ""], "Scroll document to the right", function (args) { buffer.scrollHorizontal("columns", Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, ["0", "^", ""], + mappings.add(myModes, ["0", "^"], "Scroll to the absolute left of the document", function () { buffer.scrollToPercent(0, null); }); - mappings.add(myModes, ["$", ""], + mappings.add(myModes, ["$"], "Scroll to the absolute right of the document", function () { buffer.scrollToPercent(100, null); }); @@ -1708,7 +1710,7 @@ var Buffer = Module("buffer", { function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 100); }, { count: true }); - mappings.add(myModes, ["%", ""], + mappings.add(myModes, ["%"], "Scroll to {count} percent of the document", function (args) { dactyl.assert(args.count > 0 && args.count <= 100); @@ -1716,59 +1718,59 @@ var Buffer = Module("buffer", { }, { count: true }); - mappings.add(myModes, ["", ""], + mappings.add(myModes, [""], "Scroll window downwards in the buffer", function (args) { buffer._scrollByScrollSize(args.count, true); }, { count: true }); - mappings.add(myModes, ["", ""], + mappings.add(myModes, [""], "Scroll window upwards in the buffer", function (args) { buffer._scrollByScrollSize(args.count, false); }, { count: true }); - mappings.add(myModes, ["", "", "", ""], + mappings.add(myModes, ["", "", ""], "Scroll up a full page", function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, ["", "", "", ""], + mappings.add(myModes, ["", "", ""], "Scroll down a full page", function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, ["]f", ""], + mappings.add(myModes, ["]f"], "Focus next frame", function (args) { buffer.shiftFrameFocus(Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, ["[f", ""], + mappings.add(myModes, ["[f"], "Focus previous frame", function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); }, { count: true }); - mappings.add(myModes, ["]]", ""], + mappings.add(myModes, ["]]"], "Follow the link labeled 'next' or '>' if it exists", function (args) { buffer.findLink("next", options["nextpattern"], (args.count || 1) - 1, true); }, { count: true }); - mappings.add(myModes, ["[[", ""], + mappings.add(myModes, ["[["], "Follow the link labeled 'prev', 'previous' or '<' if it exists", function (args) { buffer.findLink("previous", options["previouspattern"], (args.count || 1) - 1, true); }, { count: true }); - mappings.add(myModes, ["gf", ""], + mappings.add(myModes, ["gf"], "Toggle between rendered and source view", function () { buffer.viewSource(null, false); }); - mappings.add(myModes, ["gF", ""], + mappings.add(myModes, ["gF"], "View source with an external editor", function () { buffer.viewSource(null, true); }); - mappings.add(myModes, ["gi", ""], + mappings.add(myModes, ["gi"], "Focus last used input field", function (args) { let elem = buffer.lastInputField; @@ -1808,7 +1810,7 @@ var Buffer = Module("buffer", { dactyl.open(url, { from: "paste", where: dactyl.NEW_TAB, background: true }); }); - mappings.add(myModes, ["p", "", ""], + mappings.add(myModes, ["p", ""], "Open (put) a URL based on the current clipboard contents in the current buffer", function () { let url = dactyl.clipboardRead(); @@ -1816,7 +1818,7 @@ var Buffer = Module("buffer", { dactyl.open(url); }); - mappings.add(myModes, ["P", ""], + mappings.add(myModes, ["P"], "Open (put) a URL based on the current clipboard contents in a new buffer", function () { let url = dactyl.clipboardRead(); @@ -1825,16 +1827,16 @@ var Buffer = Module("buffer", { }); // reloading - mappings.add(myModes, ["r", ""], + mappings.add(myModes, ["r"], "Reload the current web page", function () { tabs.reload(tabs.getTab(), false); }); - mappings.add(myModes, ["R", ""], + mappings.add(myModes, ["R"], "Reload while skipping the cache", function () { tabs.reload(tabs.getTab(), true); }); // yanking - mappings.add(myModes, ["Y", ""], + mappings.add(myModes, ["Y"], "Copy selected text or current word", function () { let sel = buffer.getCurrentWord(); @@ -1843,62 +1845,62 @@ var Buffer = Module("buffer", { }); // zooming - mappings.add(myModes, ["zi", "+", ""], + mappings.add(myModes, ["zi", "+"], "Enlarge text zoom of current web page", function (args) { buffer.zoomIn(Math.max(args.count, 1), false); }, { count: true }); - mappings.add(myModes, ["zm", ""], + mappings.add(myModes, ["zm"], "Enlarge text zoom of current web page by a larger amount", function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, false); }, { count: true }); - mappings.add(myModes, ["zo", "-", ""], + mappings.add(myModes, ["zo", "-"], "Reduce text zoom of current web page", function (args) { buffer.zoomOut(Math.max(args.count, 1), false); }, { count: true }); - mappings.add(myModes, ["zr", ""], + mappings.add(myModes, ["zr"], "Reduce text zoom of current web page by a larger amount", function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, false); }, { count: true }); - mappings.add(myModes, ["zz", ""], + mappings.add(myModes, ["zz"], "Set text zoom value of current web page", function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, false); }, { count: true }); - mappings.add(myModes, ["ZI", "zI", ""], + mappings.add(myModes, ["ZI", "zI"], "Enlarge full zoom of current web page", function (args) { buffer.zoomIn(Math.max(args.count, 1), true); }, { count: true }); - mappings.add(myModes, ["ZM", "zM", ""], + mappings.add(myModes, ["ZM", "zM"], "Enlarge full zoom of current web page by a larger amount", function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, true); }, { count: true }); - mappings.add(myModes, ["ZO", "zO", ""], + mappings.add(myModes, ["ZO", "zO"], "Reduce full zoom of current web page", function (args) { buffer.zoomOut(Math.max(args.count, 1), true); }, { count: true }); - mappings.add(myModes, ["ZR", "zR", ""], + mappings.add(myModes, ["ZR", "zR"], "Reduce full zoom of current web page by a larger amount", function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, true); }, { count: true }); - mappings.add(myModes, ["zZ", ""], + mappings.add(myModes, ["zZ"], "Set full zoom value of current web page", function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, true); }, { count: true }); // page info - mappings.add(myModes, ["", ""], + mappings.add(myModes, [""], "Print the current file name", function () { buffer.showPageInfo(false); }); - mappings.add(myModes, ["g", ""], + mappings.add(myModes, ["g"], "Print file information", function () { buffer.showPageInfo(true); }); }, diff --git a/common/content/commandline.js b/common/content/commandline.js index 976b04d5..6fa3c94f 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -14,18 +14,52 @@ var CommandWidgets = Class("CommandWidgets", { init: function init() { let s = "dactyl-statusline-field-"; + let fontSize = util.computedStyle(document.documentElement).fontSize; + styles.registerSheet("resource://dactyl-skin/dactyl.css"); + styles.system.add("font-size", "dactyl://content/buffer.xhtml", + "body { font-size: " + fontSize + "; } \ + html|html > xul|scrollbar { visibility: collapse !important; }", + true); + XML.ignoreWhitespace = true; util.overlayWindow(window, { objects: { eventTarget: commandline }, append: + + + + + + + + + + + + +