From aa7d16d37358d598ad29b8fd5ff33498a16a3fb4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 26 Mar 2011 00:32:53 +1100 Subject: [PATCH 01/33] Fix :reloadall. --- common/content/tabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/tabs.js b/common/content/tabs.js index c333d636..f22e2b53 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -379,7 +379,7 @@ var Tabs = Module("tabs", { reloadAll: function (bypassCache) { this.visibleTabs.forEach(function (tab) { try { - this.reload(config.tabbrowser.mTabs[i], bypassCache); + tabs.reload(tab, bypassCache); } catch (e) { dactyl.reportError(e, true); From 10d6288bac7b953c5b8edc879c64140fc4a08bc8 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 26 Mar 2011 07:35:59 +1100 Subject: [PATCH 02/33] Fix :command -literal completion description. --- common/modules/commands.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index e422a908..31420fe9 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -1488,7 +1488,7 @@ var Commands = Module("commands", { }, { names: ["-literal", "-l"], - description: "Process the nth ignoring any quoting or meta characters", + description: "Process the specified argument ignoring any quoting or meta characters", type: CommandOption.INT }, { From 9276447f9748f2c2166707c44fa664fea3442710 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 25 Mar 2011 18:17:34 -0400 Subject: [PATCH 03/33] Add Security info to :pageinfo. --- common/content/buffer.js | 37 ++++++++++++++++++++++++- common/locale/en-US/messages.properties | 2 ++ common/locale/en-US/options.xml | 1 + common/modules/util.jsm | 2 +- pentadactyl/NEWS | 2 ++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 74799ba0..441473dd 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -141,6 +141,41 @@ var Buffer = Module("buffer", { .sort(function (a, b) util.compareIgnoreCase(a[0], b[0])); }); + let identity = window.gIdentityHandler; + this.addPageInfoSection("s", "Security", function (verbose) { + if (!verbose || !identity) + return; // For now + + // Modified from Firefox + function location(data) array.compact([ + data.city, data.state, data.country + ]).join(", "); + + switch (statusline.security) { + case "secure": + case "extended": + var data = identity.getIdentityData(); + + yield ["Host", identity.getEffectiveHost()]; + + if (statusline.security === "extended") + yield ["Owner", data.subjectOrg] + else + yield ["Owner", _("pageinfo.s.ownerUnverified", data.subjectOrg)] + + if (location(data).length) + yield ["Location", location(data)]; + + yield ["Verified by", data.caOrg]; + + if (identity._overrideService.hasMatchingOverride(identity._lastLocation.hostname, + (identity._lastLocation.port || 443), + data.cert, {}, {})) + yield ["User exception", "true"] + break; + } + }); + dactyl.commands["buffer.viewSource"] = function (event) { let elem = event.originalTarget; buffer.viewSource([elem.getAttribute("href"), Number(elem.getAttribute("line"))]); @@ -1850,7 +1885,7 @@ var Buffer = Module("buffer", { options.add(["pageinfo", "pa"], "Define which sections are shown by the :pageinfo command", - "charlist", "gfm", + "charlist", "gsfm", { get values() values(buffer.pageInfo).toObject() }); options.add(["scroll", "scr"], diff --git a/common/locale/en-US/messages.properties b/common/locale/en-US/messages.properties index 712e5402..6e6ddd28 100644 --- a/common/locale/en-US/messages.properties +++ b/common/locale/en-US/messages.properties @@ -226,6 +226,8 @@ option.popups.safeSet = See the 'activate' option. option.guioptions.safeSet = See 'guioptions' scrollbar flags. option.visualbell.safeSet = See 'visualbell' option. +pageinfo.s.ownerUnverified = %S (unverified) + plugin.searchingFor-1 = Searching for %S plugin.searchingForIn-2 = Searching for %S in %S plugin.notReplacingContext-1 = Not replacing plugin context for %S diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index 84fbe2be..b42950c5 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -1103,6 +1103,7 @@
g
General info
f
Feeds
m
Meta tags
+
s
Security information

diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 52a768b2..09fedccf 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -1246,7 +1246,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), let sentinel = "(function DactylOverlay() {}())" value.toString = function toString() toString.toString.call(this).replace(/\}?$/, sentinel + "; $&"); - value.toSource = function toSource() toString.toSource.call(this).replace(/\}?$/, sentinel + "; $&"); + value.toSource = function toSource() toSource.toSource.call(this).replace(/\}?$/, sentinel + "; $&"); delete desc.value; delete desc.writable; diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS index b4cc8253..f852b61b 100644 --- a/pentadactyl/NEWS +++ b/pentadactyl/NEWS @@ -108,6 +108,7 @@ - Added several new options, including -javascript, to :abbreviate and :map. [b2] - Added :mksyntax command to auto-generate Vim syntax files. [b4] + - Added 's' flag to :pageinfo command. [b7] - Added :pintab and :unpintab commands. [b7] - :open now only opens files beginning with /, ./, ../, or ~/ [b1] - :saveas now provides completions for default file names, and @@ -178,6 +179,7 @@ - Replaced 'focuscontent' with 'strictfocus'. [b1] - 'complete' now defaults to "slf" but file completion only triggers when the URL begins as above. [b1] + - Added 's' flag to 'pageinfo' and changed default value. [b7] - Added 'passkeys' option. [b3] - Changed 'urlseparator' default value to "|". [b3] - Added "passwords" and "venkman" dialogs to :dialog. [b2] From 75bf52f46f272c5e1db885648aad6ab768657ccc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 26 Mar 2011 10:37:10 +1100 Subject: [PATCH 04/33] Remove extraneous 'eht' ;i definition. --HG-- extra : rebase_source : 6b719404040fcdbe7e5adcded9072771e0b6c194 --- common/content/hints.js | 2 +- common/locale/en-US/options.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/content/hints.js b/common/content/hints.js index 079cdadf..e89f334d 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -1189,7 +1189,7 @@ var Hints = Module("hints", { "XPath or CSS selector strings of hintable elements for extended hint modes", "regexpmap", { "[iI]": "img", - "[asOTivVWy]": ["a[href]", "area[href]", "img[src]", "iframe[src]"], + "[asOTvVWy]": ["a[href]", "area[href]", "img[src]", "iframe[src]"], "[f]": "body", "[F]": ["body", "code", "div", "html", "p", "pre", "span"], "[S]": ["input:not([type=hidden])", "textarea", "button", "select"] diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index b42950c5..b130321c 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -635,7 +635,7 @@ 'extendedhinttags' 'eht' &option.extendedhinttags.type; - [asOTivVWy]:a[href],area[href],img[src],iframe[src], + [asOTvVWy]:a[href],area[href],img[src],iframe[src], [f]:body, [F]:body,code,div,html,p,pre,span, [iI]:img, From 204f8ca25c713e3420023786c37a31385bdbc4f3 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 25 Mar 2011 22:37:16 -0400 Subject: [PATCH 05/33] Annotate most strings which need to be explicitly localified. --- common/content/abbreviations.js | 6 +++--- common/content/bookmarks.js | 8 ++++---- common/content/buffer.js | 20 ++++++++++---------- common/content/commandline.js | 6 +++--- common/content/dactyl.js | 12 ++++++------ common/content/editor.js | 4 ++-- common/content/help.xsl | 10 +++++----- common/content/history.js | 2 +- common/content/mappings.js | 10 +++++----- common/content/mow.js | 8 ++++---- common/content/quickmarks.js | 2 +- common/content/statusline.js | 2 +- common/modules/addons.jsm | 8 ++++---- common/modules/commands.jsm | 10 +++++----- common/modules/completion.jsm | 2 +- common/modules/config.jsm | 4 ++-- common/modules/downloads.jsm | 18 +++++++++--------- common/modules/highlight.jsm | 5 ++++- common/modules/io.jsm | 10 +++++----- common/modules/javascript.jsm | 24 ++++++++++++------------ common/modules/prefs.jsm | 6 +++--- common/modules/sanitizer.jsm | 22 ++++++++++++---------- common/modules/storage.jsm | 8 ++++---- common/modules/styles.jsm | 18 ++++++++++-------- common/modules/template.jsm | 6 ++++-- common/modules/util.jsm | 16 ++++++++-------- 26 files changed, 128 insertions(+), 119 deletions(-) diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index 9a76fa37..4314abe9 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -203,9 +203,9 @@ var Abbreviations = Module("abbreviations", { let list = - - + + + { diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index a7e9bbad..ced48c6e 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -404,7 +404,7 @@ var Bookmarks = Module("bookmarks", { let frames = buffer.allFrames(); if (!args.bang) return [ - [win.document.title, frames.length == 1 ? "Current Location" : "Frame: " + win.location.href] + [win.document.title, frames.length == 1 ? /*L*/"Current Location" : /*L*/"Frame: " + win.location.href] for ([, win] in Iterator(frames))]; context.keys.text = "title"; context.keys.description = "url"; @@ -464,7 +464,7 @@ var Bookmarks = Module("bookmarks", { context.title = ["Page URL"]; let frames = buffer.allFrames(); context.completions = [ - [win.document.documentURI, frames.length == 1 ? "Current Location" : "Frame: " + win.document.title] + [win.document.documentURI, frames.length == 1 ? /*L*/"Current Location" : /*L*/"Frame: " + win.document.title] for ([, win] in Iterator(frames))]; return; } @@ -626,7 +626,7 @@ var Bookmarks = Module("bookmarks", { if (item && item.url.indexOf("%s") > -1) context.fork("keyword/" + keyword, keyword.length + space.length, null, function (context) { context.format = history.format; - context.title = [keyword + " Quick Search"]; + context.title = [/*L*/keyword + " Quick Search"]; // context.background = true; context.compare = CompletionContext.Sort.unsorted; context.generate = function () { @@ -671,7 +671,7 @@ var Bookmarks = Module("bookmarks", { return; let ctxt = context.fork(name, 0); - ctxt.title = [engine.description + " Suggestions"]; + ctxt.title = [/*L*/engine.description + " Suggestions"]; ctxt.keys = { text: util.identity, description: function () "" }; ctxt.compare = CompletionContext.Sort.unsorted; ctxt.filterFunc = null; diff --git a/common/content/buffer.js b/common/content/buffer.js index 441473dd..dd42d7df 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -75,7 +75,7 @@ var Buffer = Module("buffer", { } if (!verbose && nFeed) - yield nFeed + " feed" + (nFeed > 1 ? "s" : ""); + yield nFeed + /*L*/" feed" + (nFeed > 1 ? "s" : ""); }); this.addPageInfoSection("g", "General Info", function (verbose) { @@ -110,7 +110,7 @@ var Buffer = Module("buffer", { if (!verbose) { if (pageSize[0]) - yield (pageSize[1] || pageSize[0]) + " bytes"; + yield (pageSize[1] || pageSize[0]) + /*L*/" bytes"; yield lastMod; return; } @@ -171,7 +171,7 @@ var Buffer = Module("buffer", { if (identity._overrideService.hasMatchingOverride(identity._lastLocation.hostname, (identity._lastLocation.port || 443), data.cert, {}, {})) - yield ["User exception", "true"] + yield ["User exception", /*L*/"true"] break; } }); @@ -607,7 +607,7 @@ var Buffer = Module("buffer", { try { window.urlSecurityCheck(uri.spec, doc.nodePrincipal); - io.CommandFileMode("Save link: ", { + io.CommandFileMode(/*L*/"Save link: ", { onSubmit: function (path) { let file = io.File(path); if (file.exists() && file.isDirectory()) @@ -831,7 +831,7 @@ var Buffer = Module("buffer", { * @param {Node} elem The element to query. */ showElementInfo: function showElementInfo(elem) { - dactyl.echo(<>Element:
{util.objectToString(elem, true)}, commandline.FORCE_MULTILINE); + dactyl.echo(<>Element:
{util.objectToString(elem, true)}, commandline.FORCE_MULTILINE); }, /** @@ -1073,7 +1073,7 @@ var Buffer = Module("buffer", { scrollColumns: deprecated("buffer.scrollHorizontal", function scrollColumns(cols) buffer.scrollHorizontal("columns", cols)), scrollPages: deprecated("buffer.scrollHorizontal", function scrollPages(pages) buffer.scrollVertical("pages", pages)), scrollTo: deprecated("Buffer.scrollTo", function scrollTo(x, y) content.scrollTo(x, y)), - textZoom: deprecated("buffer.zoomValue and buffer.fullZoom", function textZoom() config.browser.markupDocumentViewer.textZoom * 100) + textZoom: deprecated("buffer.zoomValue/buffer.fullZoom", function textZoom() config.browser.markupDocumentViewer.textZoom * 100) }, { PageInfo: Struct("PageInfo", "name", "title", "action") .localize("title"), @@ -1125,13 +1125,13 @@ var Buffer = Module("buffer", { var names = []; if (node.title) - names.push([node.title, "Page Name"]); + names.push([node.title, /*L*/"Page Name"]); if (node.alt) - names.push([node.alt, "Alternate Text"]); + names.push([node.alt, /*L*/"Alternate Text"]); if (!isinstance(node, Document) && node.textContent) - names.push([node.textContent, "Link Text"]); + names.push([node.textContent, /*L*/"Link Text"]); names.push([decodeURIComponent(url.replace(/.*?([^\/]*)\/*$/, "$1")), "File Name"]); @@ -1534,7 +1534,7 @@ var Buffer = Module("buffer", { i = i + 1; return { - text: [i + ": " + (tab.label || "(Untitled)"), i + ": " + url], + text: [i + ": " + (tab.label || /*L*/"(Untitled)"), i + ": " + url], tab: tab, id: i - 1, url: url, diff --git a/common/content/commandline.js b/common/content/commandline.js index ab82fb36..611e2669 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -313,7 +313,7 @@ var CommandMode = Class("CommandMode", { open: function (command) { dactyl.assert(isinstance(this.mode, modes.COMMAND_LINE), - "Not opening command line in non-command-line mode."); + /*L*/"Not opening command line in non-command-line mode."); this.messageCount = commandline.messageCount; modes.push(this.mode, this.extendedMode, this.closure); @@ -431,7 +431,7 @@ var CommandExMode = Class("CommandExMode", CommandMode, { }, onSubmit: function onSubmit(command) { - contexts.withContext({ file: "[Command Line]", line: 1 }, + contexts.withContext({ file: /*L*/"[Command Line]", line: 1 }, function _onSubmit() { io.withSavedValues(["readHeredoc"], function _onSubmit() { this.readHeredoc = commandline.readHeredoc; @@ -1627,7 +1627,7 @@ var ItemList = Class("ItemList", { _init: function _init() { this._div = this._dom(
-
No Completions
+
No Completions
{ diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 35e8e588..f5824435 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -197,7 +197,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { argCount: "*", completer: function (context, args) { context.keys.text = util.identity; - context.keys.description = function () seen[this.text] + " matching items"; + context.keys.description = function () seen[this.text] + /*L*/" matching items"; let seen = {}; context.completions = array(item.description.toLowerCase().split(/[()\s]+/) for (item in params.iterate(args))) @@ -685,7 +685,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { unescape(encodeURI( // UTF-8 handling hack. -

Using Plugins

+

Using Plugins

{body} @@ -1010,7 +1010,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { { obj.description ? br +

{template.linkifyHelp(obj.description.replace(/\.?$/, "."), true)}

: "" }{ extraHelp ? br + extraHelp : "" }{ - !(extraHelp || obj.description) ? br +

Sorry, no help available.

: "" } + !(extraHelp || obj.description) ? br +

Sorry, no help available.

: "" }
; @@ -1073,7 +1073,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * These are set and accessed with the "g:" prefix. */ _globalVariables: {}, - globalVariables: deprecated("the options system", { + globalVariables: deprecated(/*L*/"the options system", { get: function globalVariables() this._globalVariables }), @@ -1160,7 +1160,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { onExecute: function onExecute(event) { let cmd = event.originalTarget.getAttribute("dactyl-execute"); commands.execute(cmd, null, false, null, - { file: "[Command Line]", line: 1 }); + { file: /*L*/"[Command Line]", line: 1 }); }, /** @@ -1962,7 +1962,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { commandline.commandOutput(
- ModeAbbrevReplacementModeAbbrevReplacement
- + diff --git a/common/content/editor.js b/common/content/editor.js index 6e9069ef..6f4e8836 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -321,7 +321,7 @@ var Editor = Module("editor", { try { var tmpfile = io.createTempFile(); if (!tmpfile) - throw Error("Couldn't create temporary file"); + throw Error(/*L*/"Couldn't create temporary file"); if (textBox) { highlight.highlightNode(textBox, origGroup + " EditorEditing"); @@ -329,7 +329,7 @@ var Editor = Module("editor", { } if (!tmpfile.write(text)) - throw Error("Input contains characters not valid in the current " + + throw Error(/*L*/"Input contains characters not valid in the current " + "file encoding"); var lastUpdate = Date.now(); diff --git a/common/content/help.xsl b/common/content/help.xsl index 3dcdf215..8514f92e 100644 --- a/common/content/help.xsl +++ b/common/content/help.xsl @@ -185,7 +185,7 @@
-

Contents

+

Contents

@@ -240,7 +240,7 @@ - (empty) + (empty) @@ -430,7 +430,7 @@

- Deprecated: + Deprecated:

@@ -439,7 +439,7 @@

- Note: + Note:

@@ -448,7 +448,7 @@

- Warning: + Warning:

diff --git a/common/content/history.js b/common/content/history.js index cf985d99..0d34acc7 100644 --- a/common/content/history.js +++ b/common/content/history.js @@ -219,7 +219,7 @@ var History = Module("history", { description: "The sort order of the results", completer: function (context, args) { context.compare = CompletionContext.Sort.unsorted; - return array.flatten([ + return /*L*/array.flatten([ "annotation", "date", "date added", diff --git a/common/content/mappings.js b/common/content/mappings.js index 99b6e9af..e7badaa8 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -168,7 +168,7 @@ var MapHive = Class("MapHive", Contexts.Hive, { modes = Array.concat(modes); if (!modes.every(util.identity)) - throw TypeError("Invalid modes: " + modes); + throw TypeError(/*L*/"Invalid modes: " + modes); let map = Map(modes, keys, description, action, extra); map.definedAt = contexts.getCaller(Components.stack.caller); @@ -431,9 +431,9 @@ var Mappings = Module("mappings", { let list =
Code execution summaryCode execution summary
  Executed:{count}times
  Average time:{each.toFixed(2)}{eachUnits}
- - + + + { @@ -531,7 +531,7 @@ var Mappings = Module("mappings", { { names: ["-description", "-desc", "-d"], description: "A description of this mapping", - default: "User-defined mapping", + default: /*L*/"User-defined mapping", type: CommandOption.STRING }, { diff --git a/common/content/mow.js b/common/content/mow.js index d0afda6f..51e55076 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -53,16 +53,16 @@ var MOW = Module("mow", { diff --git a/common/content/quickmarks.js b/common/content/quickmarks.js index c12e7681..0e73b4f3 100644 --- a/common/content/quickmarks.js +++ b/common/content/quickmarks.js @@ -157,7 +157,7 @@ var QuickMarks = Module("quickmarks", { context.fork("current", 0, this, function (context) { context.title = ["Extra Completions"]; context.completions = [ - [quickmarks.get(args[0]), "Current Value"] + [quickmarks.get(args[0]), _("option.currentValue")] ].filter(function ([k, v]) k); }); context.fork("url", 0, completion, "url"); diff --git a/common/content/statusline.js b/common/content/statusline.js index b36b238f..3a5f3d2e 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -308,7 +308,7 @@ var StatusLine = Module("statusline", { else if (typeof progress == "number") { let progressStr = ""; if (this._progress <= 0) - progressStr = "[ Loading... ]"; + progressStr = /*L*/"[ Loading... ]"; else if (this._progress < 1) { let progress = Math.round(this._progress * 20); progressStr = "[" diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 290c8ebd..2d584911 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -282,11 +282,11 @@ var AddonList = Class("AddonList", { XML.ignoreWhitespace = true; util.xmlToDom(
- ModeCommandActionModeCommandAction
- - - + + + +
NameVersionStatusNameVersionStatus - DescriptionDescription
, this.document, this.nodes); diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 31420fe9..7f40a961 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -657,11 +657,11 @@ var Commands = Module("commands", { - Name - Args - Range - Complete - Definition + Name + Args + Range + Complete + Definition { diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index 74e8cf15..2e29c638 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -960,7 +960,7 @@ var Completion = Module("completion", { context.title = ["URL", "Title"]; context.fork("additional", 0, this, function (context) { - context.title[0] += " (additional)"; + context.title[0] += /*L*/" (additional)"; context.filter = context.parent.filter; // FIXME context.completions = context.parent.completions; // For items whose URL doesn't exactly match the filter, diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 310545e6..cb18251f 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -159,7 +159,7 @@ var ConfigBase = Class("ConfigBase", { "--template=hg{rev}-" + this.branch + " ({date|isodate})"]).output; let version = this.addon.version; if ("@DATE@" !== "@" + "DATE@") - version += " (created: @DATE@)"; + version += /*L*/" (created: @DATE@)"; return version; }), @@ -624,7 +624,7 @@ var ConfigBase = Class("ConfigBase", { HelpEx;;;FontCode display: inline-block; color: #527BBD; HelpExample display: block; margin: 1em 0; - HelpExample::before content: "Example: "; font-weight: bold; + HelpExample::before content: /*L*/"Example: "; font-weight: bold; HelpInfo display: block; width: 20em; margin-left: auto; HelpInfoLabel display: inline-block; width: 6em; color: magenta; font-weight: bold; vertical-align: text-top; diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm index 39441259..b4d8e070 100644 --- a/common/modules/downloads.jsm +++ b/common/modules/downloads.jsm @@ -137,7 +137,7 @@ var Download = Class("Download", { if (this.timeRemaining) this.nodes.time.textContent = util.formatSeconds(this.timeRemaining); else - this.nodes.time.textContent = "~1 second"; + this.nodes.time.textContent = /*L*/"~1 second"; } let total = this.nodes.progressTotal.textContent = this.size ? util.formatBytes(this.size, 1, true) : "Unknown"; let suffix = RegExp(/( [a-z]+)?$/i.exec(total)[0] + "$"); @@ -182,20 +182,20 @@ var DownloadList = Class("DownloadList", util.xmlToDom( - Title - Status + Title + Status - Progress + Progress - Time remaining - Source + Time remaining + Source
- + - - + + + @@ -377,8 +377,8 @@ var Styles = Module("Styles", { context.fork("current", 0, this, function (context) { context.title = ["Current Site"]; context.completions = [ - [content.location.host, "Current Host"], - [content.location.href, "Current URL"] + [content.location.host, /*L*/"Current Host"], + [content.location.href, /*L*/"Current URL"] ]; }); } @@ -389,7 +389,7 @@ var Styles = Module("Styles", { context.generate = function () values(group.sites); context.keys.text = util.identity; - context.keys.description = function (site) this.sheets.length + " sheet" + (this.sheets.length == 1 ? "" : "s") + ": " + + context.keys.description = function (site) this.sheets.length + /*L*/" sheet" + (this.sheets.length == 1 ? "" : "s") + ": " + array.compact(this.sheets.map(function (s) s.name)).join(", "); context.keys.sheets = function (site) group.sheets.filter(function (s) s.sites.indexOf(site) >= 0); context.keys.active = function (site) uris.some(Styles.matchFilter(site)); @@ -434,7 +434,7 @@ var Styles = Module("Styles", { for (let item in Iterator({ Active: true, Inactive: false })) { let [name, active] = item; context.split(name, null, function (context) { - context.title[0] = name + " " + (title || "Sheets"); + context.title[0] = /*L*/name + " " + (title || "Sheets"); context.filters.push(function (item) !!item.active == active); }); } @@ -584,7 +584,9 @@ var Styles = Module("Styles", { } else if (args.completeArg == 1) { if (sheet) - context.completions = [[sheet.css, "Current Value"]]; + context.completions = [ + [sheet.css, _("option.currentValue")] + ]; context.fork("css", 0, modules.completion, "css"); } }, diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 8a398c2e..b979e709 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -363,7 +363,9 @@ var Template = Module("Template", { // return
Totals: Totals:  - Clear + Clear {result.output}); @@ -981,9 +981,9 @@ unlet s:cpo_save context.key = match.prefix; context.advance(match.prefix.length + 1); context.generate = function () iter({ - content: "Chrome content", - locale: "Locale-specific content", - skin: "Theme-specific content" + content: /*L*/"Chrome content", + locale: /*L*/"Locale-specific content", + skin: /*L*/"Theme-specific content" }); } } diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index 49feed58..981ec418 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -45,7 +45,7 @@ var JavaScript = Module("javascript", { }), globals: Class.memoize(function () [ - [this.modules.userContext, "Global Variables"], + [this.modules.userContext, /*L*/"Global Variables"], [this.modules, "modules"], [this.window, "window"] ]), @@ -120,9 +120,9 @@ var JavaScript = Module("javascript", { context[JavaScript.EVAL_EXPORT] = function export_(obj) cache[key] = obj; try { if (tmp != null) // Temporary hack until bug 609949 is fixed. - this.modules.dactyl.userEval(JavaScript.EVAL_EXPORT + "(" + arg + ")", context, "[Command Line Completion]", 1); + this.modules.dactyl.userEval(JavaScript.EVAL_EXPORT + "(" + arg + ")", context, /*L*/"[Command Line Completion]", 1); else - cache[key] = this.modules.dactyl.userEval(arg, context, "[Command Line Completion]", 1); + cache[key] = this.modules.dactyl.userEval(arg, context, /*L*/"[Command Line Completion]", 1); return cache[key]; } @@ -170,7 +170,7 @@ var JavaScript = Module("javascript", { if (this._top.char != arg) { this.context.highlight(this._top.offset, this._i - this._top.offset, "SPELLCHECK"); - throw Error("Invalid JS"); + throw Error(/*L*/"Invalid JS"); } // The closing character of this stack frame will have pushed a new @@ -308,7 +308,7 @@ var JavaScript = Module("javascript", { if (this._checkFunction(prev, dot, cacheKey)) return []; if (prev != statement && obj == null) { - this.context.message = "Error: " + cacheKey.quote() + " is " + String(obj); + this.context.message = /*L*/"Error: " + cacheKey.quote() + " is " + String(obj); return []; } @@ -324,7 +324,7 @@ var JavaScript = Module("javascript", { let end = (frame == -1 ? this._lastIdx : this._get(frame + 1).offset); this._cacheKey = null; - let obj = [[this.cache.evalContext, "Local Variables"]].concat(this.globals); + let obj = [[this.cache.evalContext, /*L*/"Local Variables"]].concat(this.globals); // Is this an object dereference? if (dot < statement) // No. dot = statement - 1; @@ -339,7 +339,7 @@ var JavaScript = Module("javascript", { const self = this; if (!getOwnPropertyNames && !services.debugger.isOn && !this.context.message) - this.context.message = "For better completion data, please enable the JavaScript debugger (:set jsdebugger)"; + this.context.message = /*L*/"For better completion data, please enable the JavaScript debugger (:set jsdebugger)"; let base = this.context.fork("js", this._top.offset); base.forceAnchored = true; @@ -419,14 +419,14 @@ var JavaScript = Module("javascript", { objects.forEach(function (obj) { obj.ctxt_p.split(obj[1] + "/anchored", this, function (context) { context.anchored = true; - context.title[0] += " (prototypes)"; + context.title[0] += /*L*/" (prototypes)"; }); }); objects.forEach(function (obj) { obj.ctxt_t.split(obj[1] + "/unanchored", this, function (context) { context.anchored = false; - context.title[0] += " (substrings)"; + context.title[0] += /*L*/" (substrings)"; context.filters.push(unanchored); }); }); @@ -434,7 +434,7 @@ var JavaScript = Module("javascript", { objects.forEach(function (obj) { obj.ctxt_p.split(obj[1] + "/unanchored", this, function (context) { context.anchored = false; - context.title[0] += " (prototype substrings)"; + context.title[0] += /*L*/" (prototype substrings)"; context.filters.push(unanchored); }); }); @@ -775,8 +775,8 @@ var JavaScript = Module("javascript", { this.js.newContext = function newContext() modules.newContext(self.context, !sandbox); this.js.globals = [ - [this.context, "REPL Variables"], - [context, "REPL Global"] + [this.context, /*L*/"REPL Variables"], + [context, /*L*/"REPL Global"] ].concat(this.js.globals.filter(function ([global]) isPrototypeOf.call(global, context))); if (!isPrototypeOf.call(modules.jsmodules, context)) diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm index e9b85bbb..6837f735 100644 --- a/common/modules/prefs.jsm +++ b/common/modules/prefs.jsm @@ -115,7 +115,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) } }; - return template.options(config.host + " Preferences", prefs.call(this)); + return template.options(/*L*/config.host + " Preferences", prefs.call(this)); }, /** @@ -219,8 +219,8 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) function assertType(needType) util.assert(type === Ci.nsIPrefBranch.PREF_INVALID || type === needType, type === Ci.nsIPrefBranch.PREF_INT - ? "E521: Number required after =: " + name + "=" + value - : "E474: Invalid argument: " + name + "=" + value); + ? /*L*/"E521: Number required after =: " + name + "=" + value + : /*L*/"E474: Invalid argument: " + name + "=" + value); let type = this.branch.getPrefType(name); switch (typeof value) { diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 27880c13..837a9a6b 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -183,7 +183,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef append: { SanitizeDialogPane: -
+ { @@ -204,7 +204,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef function (win) prefOverlay(branch, false, { append: { itemList: <> - + { template.map(ourItems(), function ([item, desc])
- NameFilterCSSNameFilterCSS
- + + + { this.map(Iterator(elems), function ([idx, val]) @@ -494,7 +496,7 @@ var Template = Module("Template", { let (name = item.name || item.names[0], frame = item.definedAt) !frame ? name : template.helpLink(help(item), name, "Title") + - Defined at {sourceLink(frame)} + Defined at {sourceLink(frame)} } { item.columns ? template.map(item.columns, function (c) ) : "" } diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 09fedccf..989f6ef1 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -309,7 +309,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), } else if (char === "]") { stack.pop(); - util.assert(stack.length, "Unmatched %] in format"); + util.assert(stack.length, /*L*/"Unmatched %] in format"); } else { let quote = function quote(obj, char) obj[char]; @@ -328,7 +328,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (end < format.length) stack.top.elements.push(format.substr(end)); - util.assert(stack.length === 1, "Unmatched %[ in format"); + util.assert(stack.length === 1, /*L*/"Unmatched %[ in format"); return stack.top; }, @@ -375,7 +375,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), } else if (close) { stack.pop(); - util.assert(stack.length, "Unmatched %] in macro"); + util.assert(stack.length, /*L*/"Unmatched %] in macro"); } else { let [, flags, name] = /^((?:[a-z]-)*)(.*)/.exec(macro); @@ -402,7 +402,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (end < macro.length) stack.top.elements.push(macro.substr(end)); - util.assert(stack.length === 1, "Unmatched <{ in macro"); + util.assert(stack.length === 1, /*L*/"Unmatched <{ in macro"); return stack.top; }, @@ -759,12 +759,12 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), [hours, minutes] = div(minutes, 60); [days, hours] = div(hours, 24); if (days) - return days + " days " + hours + " hours" + return /*L*/days + " days " + hours + " hours" if (hours) - return hours + "h " + minutes + "m"; + return /*L*/hours + "h " + minutes + "m"; if (minutes) - return minutes + ":" + pad(2, seconds); - return seconds + "s"; + return /*L*/minutes + ":" + pad(2, seconds); + return /*L*/seconds + "s"; }, /** From d0831ec8e6efc27b335e65fbbfd36147f0a33aa7 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 26 Mar 2011 15:27:59 -0400 Subject: [PATCH 06/33] Add missing docs and make 'showmode' a stringlist like 'passunknown' rather than a regexplist. --- common/content/dactyl.js | 4 ++ common/content/modes.js | 123 ++++++++++++++++++++++---------- common/locale/en-US/map.xml | 11 ++- common/locale/en-US/options.xml | 23 +++++- common/locale/en-US/tabs.xml | 4 +- common/modules/commands.jsm | 2 +- common/modules/config.jsm | 5 +- pentadactyl/NEWS | 2 + 8 files changed, 131 insertions(+), 43 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index f5824435..1bb6a68a 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -605,6 +605,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * Initialize the help system. */ initHelp: function (force) { + // Waits for the add-on to become available, if necessary. + config.addon; + config.version; + if (force || !this.helpInitialized) { if ("noscriptOverlay" in window) { noscriptOverlay.safeAllow("chrome-data:", true, false); diff --git a/common/content/modes.js b/common/content/modes.js index 2840ea6c..4976db15 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -207,6 +207,51 @@ var Modes = Module("modes", { } }); + + function makeTree() { + let list = modes.all.filter(function (m) m.name !== m.description); + + let tree = {}; + + for (let mode in values(list)) + tree[mode.name] = {}; + + for (let mode in values(list)) + for (let base in values(mode.bases)) + tree[base.name][mode.name] = tree[mode.name]; + + let roots = iter([m.name, tree[m.name]] for (m in values(list)) if (!m.bases.length)).toObject(); + + default xml namespace = NS; + function rec(obj) { + XML.ignoreWhitespace = XML.prettyPrinting = false; + + let res =
    ; + Object.keys(obj).sort().forEach(function (mode) { + res.* +=
  • {mode}: {modes.getMode(mode).description}{ + rec(obj[mode]) + }
  • ; + }); + + if (res.*.length()) + return res; + return <>; + } + + return rec(roots).toXMLString(); + } + + util.timeout(function () { + // Waits for the add-on to become available, if necessary. + config.addon; + config.version; + + services["dactyl:"].pages["modes.dtd"] = services["dactyl:"].pages["modes.dtd"](); + }); + + services["dactyl:"].pages["modes.dtd"] = function () [null, + util.makeDTD(iter({ "modes.tree": makeTree() }, + config.dtd))]; }, cleanup: function cleanup() { modes.reset(); @@ -278,9 +323,13 @@ var Modes = Module("modes", { // show the current mode string in the command line show: function show() { + if (!loaded.modes) + return; + let msg = null; - if (options.get("showmode").getKey(this.main.name, true)) + if (options.get("showmode").getKey([this.main].concat(this.main.allBases), false)) msg = this._getModeMessage(); + if (msg || loaded.commandline) commandline.widgets.mode = msg || null; }, @@ -452,7 +501,7 @@ var Modes = Module("modes", { this === obj || this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj, allBases: Class.memoize(function () { - let seen = {}, res = [], queue = this.bases; + let seen = {}, res = [], queue = this.bases.slice(); for (let mode in array.iterValues(queue)) if (!set.add(seen, mode)) { res.push(mode); @@ -552,45 +601,47 @@ var Modes = Module("modes", { function () { events.feedkeys(""); }); }, options: function initOptions() { - options.add(["passunknown"], + let opts = { + completer: function completer(context, extra) { + if (extra.value && context.filter[0] == "!") + context.advance(1); + return completer.superapply(this, arguments); + }, + + getKey: function getKey(val, default_) { + if (isArray(val)) + return (array.nth(this.value, function (v) val.some(function (m) m.name === v.mode), 0) + || { result: default_ }).result; + + return set.has(this.valueMap, val) ? this.valueMap[val] : default_; + }, + + setter: function (vals) { + modes.all.forEach(function (m) { delete m.passUnknown }); + + vals = vals.map(function (v) update(new String(v.toLowerCase()), { + mode: v.replace(/^!/, "").toUpperCase(), + result: v[0] !== "!" + })); + + this.valueMap = values(vals).map(function (v) [v.mode, v.result]).toObject(); + return vals; + }, + + validator: function validator(vals) vals.map(function (v) v.replace(/^!/, "")).every(set.has(this.values)), + + get values() array.toObject([[m.name.toLowerCase(), m.description] for (m in values(modes._modes)) if (!m.hidden)]) + }; + + options.add(["passunknown", "pu"], "Pass through unknown keys in these modes", "stringlist", "!text_edit,!input,base", - { - completer: function completer(context, extra) { - if (extra.value && context.filter[0] == "!") - context.advance(1); - return completer.superapply(this, arguments); - }, - - getKey: function getKey(val, default_) { - if (isArray(val)) - return (array.nth(this.value, function (v) val.some(function (m) m.name === v.mode), 0) - || { result: default_ }).result; - - return set.has(this.valueMap, val) ? this.valueMap[val] : default_; - }, - - setter: function (vals) { - modes.all.forEach(function (m) { delete m.passUnknown }); - - vals = vals.map(function (v) update(new String(v.toLowerCase()), { - mode: v.replace(/^!/, "").toUpperCase(), - result: v[0] !== "!" - })); - - this.valueMap = values(vals).map(function (v) [v.mode, v.result]).toObject(); - return vals; - }, - - validator: function validator(vals) vals.map(function (v) v.replace(/^!/, "")).every(set.has(this.values)), - - get values() array.toObject([[m.name.toLowerCase(), m.description] for (m in values(modes._modes)) if (!m.hidden)]) - }); + opts); options.add(["showmode", "smd"], "Show the current mode in the command line when it matches this expression", - "regexplist", "!^normal$", - { regexpFlags: "i" }); + "stringlist", "!normal,base", + opts); }, prefs: function initPrefs() { prefs.watch("accessibility.browsewithcaret", function () modes.onCaretChange.apply(modes, arguments)); diff --git a/common/locale/en-US/map.xml b/common/locale/en-US/map.xml index 7b777129..92b0291a 100644 --- a/common/locale/en-US/map.xml +++ b/common/locale/en-US/map.xml @@ -1,7 +1,7 @@ - + :mk&dactyl.name;rc command. +

    + The following tree represents all of the modes understood by + dactyl. Mappings for a mode also apply to its children and + descendants. So a mapping in the BASE mode, for instance, is + also active in NORMAL and EX mode. +

    + +&modes.tree; +

    Map commands

    diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index b130321c..080fe4c1 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -1143,6 +1143,21 @@ + + 'pu' 'passunknown' + 'passunknown' 'pu' + &option.showmode.type; + &option.showmode.default; + +

    + Pass unknown keys through to &dactyl.host; in these + modes. The first element matching a currently + active mode is the one that takes effect. Modes may be + negated by prefixing them with a !. +

    +
    +
    + 'pps' 'popups' 'popups' 'pps' @@ -1330,13 +1345,17 @@ - 'nosmd' 'noshowmode' 'smd' 'showmode' 'showmode' 'smd' &option.showmode.type; &option.showmode.default; -

    Show the current mode in the command line if it matches this expression.

    +

    + Show the current mode in the command line if it or any + of its parent modes is included in the list. + Modes may be negated by prefixing them with a + !. +

    diff --git a/common/locale/en-US/tabs.xml b/common/locale/en-US/tabs.xml index 25e668c8..64138dcb 100644 --- a/common/locale/en-US/tabs.xml +++ b/common/locale/en-US/tabs.xml @@ -384,7 +384,7 @@

    Application Tabs

    - pin pintab + :pin :pintab countpintab! arg

    @@ -396,7 +396,7 @@ - unpin unpintab + :unpin :unpintab countpintab arg

    diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 7f40a961..3c60ad87 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -1573,7 +1573,7 @@ var Commands = Module("commands", { ] })), iterateIndex: function (args) let (tags = services["dactyl:"].HELP_TAGS) - this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || set.has(cmd.helpTag)), + this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || set.has(tags, cmd.helpTag)), format: { headings: ["Command", "Group", "Description"], description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")), diff --git a/common/modules/config.jsm b/common/modules/config.jsm index cb18251f..bc67e657 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -206,7 +206,7 @@ var ConfigBase = Class("ConfigBase", { "version" ], - helpStyles: /^(Help|StatusLine|REPL)|^(Boolean|Indicator|MoreMsg|Number|Object|Logo|Key(word)?|String)$/, + helpStyles: /^(Help|StatusLine|REPL)|^(Boolean|Dense|Indicator|MoreMsg|Number|Object|Logo|Key(word)?|String)$/, styleHelp: function styleHelp() { if (!this.helpStyled) { const { highlight } = require("highlight"); @@ -457,6 +457,9 @@ var ConfigBase = Class("ConfigBase", { CompMore::after content: "⌄"; + Dense margin-top: 0; margin-bottom: 0; + + EditorEditing;;* background: #bbb !important; -moz-user-input: none !important; -moz-user-modify: read-only !important; EditorError;;* background: red !important; EditorBlink1;;* background: yellow !important; diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS index f852b61b..79321c2d 100644 --- a/pentadactyl/NEWS +++ b/pentadactyl/NEWS @@ -181,8 +181,10 @@ triggers when the URL begins as above. [b1] - Added 's' flag to 'pageinfo' and changed default value. [b7] - Added 'passkeys' option. [b3] + - Added 'passunknown' option. [b7] - Changed 'urlseparator' default value to "|". [b3] - Added "passwords" and "venkman" dialogs to :dialog. [b2] + - Make 'showmode' a stringlist option. [b7] - Added 'wildanchor' option. [b2] - Added 'cookies', 'cookieaccept', and 'cookielifetime' options. [b3] • Added BookmarkChange, BookmarkRemove autocommands. [b2] From cb13b387855546c41a2c4473adb831199ee16b93 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 26 Mar 2011 17:36:26 -0400 Subject: [PATCH 07/33] Fix variable collision in editor.js. --- common/content/editor.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/content/editor.js b/common/content/editor.js index 6f4e8836..86b8440c 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -272,10 +272,10 @@ var Editor = Module("editor", { column = 1 + pre.replace(/[^]*\n/, "").length; } else { - var editor = window.GetCurrentEditor ? GetCurrentEditor() - : Editor.getEditor(document.commandDispatcher.focusedWindow); - dactyl.assert(editor); - text = Array.map(editor.rootElement.childNodes, function (e) util.domToString(e, true)).join(""); + var editor_ = window.GetCurrentEditor ? GetCurrentEditor() + : Editor.getEditor(document.commandDispatcher.focusedWindow); + dactyl.assert(editor_); + text = Array.map(editor_.rootElement.childNodes, function (e) util.domToString(e, true)).join(""); } let origGroup = textBox && textBox.getAttributeNS(NS, "highlight") || ""; @@ -312,9 +312,9 @@ var Editor = Module("editor", { if (textBox) textBox.value = val; else { - while (editor.rootElement.firstChild) - editor.rootElement.removeChild(editor.rootElement.firstChild); - editor.rootElement.innerHTML = val; + while (editor_.rootElement.firstChild) + editor_.rootElement.removeChild(editor_.rootElement.firstChild); + editor_.rootElement.innerHTML = val; } } From 0442577479bb6ea95ea9c42b4d7b664bcff9a788 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 28 Mar 2011 08:01:56 +1100 Subject: [PATCH 08/33] Fix :set!. --- common/modules/options.jsm | 6 +++--- common/tests/functional/testCommands.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/modules/options.jsm b/common/modules/options.jsm index de033724..0e575c1c 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -978,7 +978,7 @@ var Options = Module("options", { }, { }, { commands: function initCommands(dactyl, modules, window) { - const { commands, contexts, options } = modules; + const { commandline, commands, contexts, options } = modules; let args = { getMode: function (args) findMode(args["-mode"]), @@ -1048,7 +1048,7 @@ var Options = Module("options", { } if (name == "all" && reset) - modules.commandline.input(_("pref.prompt.resetAll", config.host) + " ", + commandline.input(_("pref.prompt.resetAll", config.host) + " ", function (resp) { if (resp == "yes") for (let pref in values(prefs.getNames())) @@ -1078,7 +1078,7 @@ var Options = Module("options", { prefs.set(name, value); } else - modules.commandline.commandOutput(prefs.list(onlyNonDefault, name)); + commandline.commandOutput(prefs.list(onlyNonDefault, name)); return; } diff --git a/common/tests/functional/testCommands.js b/common/tests/functional/testCommands.js index 59724b55..d317cbf6 100644 --- a/common/tests/functional/testCommands.js +++ b/common/tests/functional/testCommands.js @@ -545,7 +545,7 @@ var tests = { set: { multiOutput: [ "vb?", "cpt?", "messages?", "titlestring?", "au?", "eht?", - "cpt", "messages", "titlestring", "au", "eht" + "cpt", "messages", "titlestring", "au", "eht", "! " ], noOutput: ["vb", "novb"], completions: [ From 207b6dca72bb2b4e4a02124bc96497923c312cfb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 28 Mar 2011 09:42:44 +1100 Subject: [PATCH 09/33] Fix :set! without premature commandline instantiation. Fix :let and options.listPrefs. --- common/modules/options.jsm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/modules/options.jsm b/common/modules/options.jsm index 0e575c1c..e856cd4e 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -870,7 +870,7 @@ var Options = Module("options", { allPrefs: deprecated("prefs.getNames", function allPrefs() prefs.getNames.apply(prefs, arguments)), getPref: deprecated("prefs.get", function getPref() prefs.get.apply(prefs, arguments)), invertPref: deprecated("prefs.invert", function invertPref() prefs.invert.apply(prefs, arguments)), - listPrefs: deprecated("prefs.list", function listPrefs() { commandline.commandOutput(prefs.list.apply(prefs, arguments)); }), + listPrefs: deprecated("prefs.list", function listPrefs() { this.modules.commandline.commandOutput(prefs.list.apply(prefs, arguments)); }), observePref: deprecated("prefs.observe", function observePref() prefs.observe.apply(prefs, arguments)), popContext: deprecated("prefs.popContext", function popContext() prefs.popContext.apply(prefs, arguments)), pushContext: deprecated("prefs.pushContext", function pushContext() prefs.pushContext.apply(prefs, arguments)), @@ -978,7 +978,7 @@ var Options = Module("options", { }, { }, { commands: function initCommands(dactyl, modules, window) { - const { commandline, commands, contexts, options } = modules; + const { commands, contexts, options } = modules; let args = { getMode: function (args) findMode(args["-mode"]), @@ -1048,7 +1048,7 @@ var Options = Module("options", { } if (name == "all" && reset) - commandline.input(_("pref.prompt.resetAll", config.host) + " ", + modules.commandline.input(_("pref.prompt.resetAll", config.host) + " ", function (resp) { if (resp == "yes") for (let pref in values(prefs.getNames())) @@ -1056,7 +1056,7 @@ var Options = Module("options", { }, { promptHighlight: "WarningMsg" }); else if (name == "all") - commandline.commandOutput(prefs.list(onlyNonDefault, "")); + modules.commandline.commandOutput(prefs.list(onlyNonDefault, "")); else if (reset) prefs.reset(name); else if (invertBoolean) @@ -1078,7 +1078,7 @@ var Options = Module("options", { prefs.set(name, value); } else - commandline.commandOutput(prefs.list(onlyNonDefault, name)); + modules.commandline.commandOutput(prefs.list(onlyNonDefault, name)); return; } @@ -1235,7 +1235,7 @@ var Options = Module("options", { if (str.text().length() == str.*.length()) dactyl.echomsg(_("variable.none")); else - dactyl.echo(str, commandline.FORCE_MULTILINE); + dactyl.echo(str, modules.commandline.FORCE_MULTILINE); return; } From 78430defc2fd297c5bea563a3d8471aa8400673c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 28 Mar 2011 10:34:45 +1100 Subject: [PATCH 10/33] Fix message key typo. --- common/content/marks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/marks.js b/common/content/marks.js index c5a3ef04..fc63bc83 100644 --- a/common/content/marks.js +++ b/common/content/marks.js @@ -146,7 +146,7 @@ var Marks = Module("marks", { let mark = (this._localMarks.get(this.localURI) || {})[char]; dactyl.assert(mark, _("mark.unset", char)); - dactyl.log(_("marks.jumpingToLocal", Marks.markToString(char, mark)), 5); + dactyl.log(_("mark.jumpingToLocal", Marks.markToString(char, mark)), 5); buffer.scrollToPercent(mark.position.x * 100, mark.position.y * 100); } else From ccf1d0d4332275927245fb406efb0dae1523926c Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sun, 27 Mar 2011 23:25:19 -0400 Subject: [PATCH 11/33] Fix hint indicator positioning on sites with stupid CSS rules. --- common/skin/dactyl.css | 1 + 1 file changed, 1 insertion(+) diff --git a/common/skin/dactyl.css b/common/skin/dactyl.css index 57b01d3c..42377000 100644 --- a/common/skin/dactyl.css +++ b/common/skin/dactyl.css @@ -9,6 +9,7 @@ [dactyl|highlight~=hints] { -moz-binding: url(resource://dactyl-content/bindings.xml#hints) !important; + position: static !important; } [dactyl|highlight~=HintImage], From b485c9d55e713774b4321742d3ab56bb115cabcf Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 28 Mar 2011 16:37:48 +1100 Subject: [PATCH 12/33] Match :macros name spec to documentation :mac[ros]. Closes issue #466. --HG-- extra : rebase_source : 0c45a7fc95b9949a4d05507e0ef135cce6676831 --- common/content/events.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/events.js b/common/content/events.js index 21b44758..81644e87 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1530,7 +1530,7 @@ var Events = Module("events", { literal: 0 }); - commands.add(["macros"], + commands.add(["mac[ros]"], "List all macros", function (args) { completion.listCompleter("macro", args[0]); }, { argCount: "?", From c2d2415b1a962b9e6140deb9bfa6593c2804c4e9 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 28 Mar 2011 19:53:38 -0400 Subject: [PATCH 13/33] Don't feed keys to document.activeElement unless it's an input element. Closes issue #467. --- common/content/events.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 81644e87..3b8b042d 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -669,12 +669,15 @@ var Events = Module("events", { let doc = document.commandDispatcher.focusedWindow.document; let event = events.create(doc, type, evt); + let target = dactyl.focusedElement + || ["complete", "interactive"].indexOf(doc.readyState) >= 0 && doc.documentElement + || doc.defaultView; + + if (target instanceof Element && !Events.isInputElement(target)) + target = target.ownerDocument.documentElement; if (!evt_obj.dactylString && !mode) - events.dispatch(dactyl.focusedElement - || ["complete", "interactive"].indexOf(doc.readyState) >= 0 && doc.documentElement - || doc.defaultView, - event, evt); + events.dispatch(target, event, evt); else if (type === "keypress") events.events.keypress.call(events, event); } From 477b1139fc123d1dcb12fcc156df8d439bb6f096 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 31 Mar 2011 18:44:18 -0400 Subject: [PATCH 14/33] Add missing services.tld. --- common/content/modes.js | 2 +- common/modules/base.jsm | 10 ++------- common/modules/bookmarkcache.jsm | 1 - common/modules/bootstrap.jsm | 36 +++++++++++++++++++++++++++++++- common/modules/services.jsm | 1 + 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/common/content/modes.js b/common/content/modes.js index 4976db15..bdac8a26 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -640,7 +640,7 @@ var Modes = Module("modes", { options.add(["showmode", "smd"], "Show the current mode in the command line when it matches this expression", - "stringlist", "!normal,base", + "stringlist", "caret,output_multiline,!normal,base", opts); }, prefs: function initPrefs() { diff --git a/common/modules/base.jsm b/common/modules/base.jsm index f39f17bf..a57f04ed 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -142,6 +142,7 @@ function defineModule(name, params, module) { use[mod].push(module); } currentModule = module; + module.startTime = Date.now(); } defineModule.loadLog = []; @@ -163,7 +164,6 @@ defineModule.dump = function dump_() { .replace(/^./gm, name + ": $&")); } defineModule.modules = []; -defineModule.times = { all: 0 }; defineModule.time = function time(major, minor, func, self) { let time = Date.now(); if (typeof func !== "function") @@ -176,13 +176,7 @@ defineModule.time = function time(major, minor, func, self) { loaded.util && util.reportError(e); } - let delta = Date.now() - time; - defineModule.times.all += delta; - defineModule.times[major] = (defineModule.times[major] || 0) + delta; - if (minor) { - defineModule.times[":" + minor] = (defineModule.times[":" + minor] || 0) + delta; - defineModule.times[major + ":" + minor] = (defineModule.times[major + ":" + minor] || 0) + delta; - } + JSMLoader.times.add(major, minor, Date.now() - time); return res; } diff --git a/common/modules/bookmarkcache.jsm b/common/modules/bookmarkcache.jsm index 8f12b6a4..e85a7c6c 100644 --- a/common/modules/bookmarkcache.jsm +++ b/common/modules/bookmarkcache.jsm @@ -151,7 +151,6 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), { return this.rootFolders.indexOf(root) >= 0; }, - // Should be made thread safe. load: function load() { let bookmarks = {}; diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index 005ba162..6945b05b 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -32,6 +32,26 @@ else manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar), stale: JSMLoader ? JSMLoader.stale : {}, suffix: "", + + times: { + all: 0, + add: function add(major, minor, delta) { + this.all += delta; + + this[major] = (this[major] || 0) + delta; + if (minor) { + minor = ":" + minor; + this[minor] = (this[minor] || 0) + delta; + this[major + minor] = (this[major + minor] || 0) + delta; + } + }, + clear: function clear() { + for (let key in this) + if (typeof this[key] !== "number") + delete this[key]; + } + }, + init: function init(suffix) { this.initialized = true; this.suffix = suffix || ""; @@ -41,6 +61,7 @@ else this.global.JSMLoader = this; base.JSMLoader = this; }, + getTarget: function getTarget(url) { if (url.indexOf(":") === -1) url = "resource://dactyl" + this.suffix + "/" + url; @@ -49,6 +70,7 @@ else chan.cancel(Components.results.NS_BINDING_ABORTED); return chan.name; }, + load: function load(name, target) { let url = name; if (url.indexOf(":") === -1) @@ -68,7 +90,12 @@ else } try { + let now = Date.now(); let global = Components.utils.import(url, target); + + if (!(name in this.globals)) + this.times.add("require", name, Date.now() - now); + return this.globals[name] = global; } catch (e) { @@ -76,11 +103,18 @@ else throw e; } }, - loadSubScript: function loadSubScript() this.loader.loadSubScript.apply(this.loader, arguments), + + loadSubScript: function loadSubScript(script) { + let now = Date.now(); + this.loader.loadSubScript.apply(this.loader, arguments); + this.times.add("loadSubScript", script, Date.now() - now); + }, + cleanup: function unregister() { for each (let factory in this.factories.splice(0)) this.manager.unregisterFactory(factory.classID, factory); }, + purge: function purge() { dump("dactyl: JSMLoader: purge\n"); diff --git a/common/modules/services.jsm b/common/modules/services.jsm index 29acc7b0..dbfe8f90 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -59,6 +59,7 @@ var Services = Module("Services", { this.add("stylesheet", "@mozilla.org/content/style-sheet-service;1", "nsIStyleSheetService"); this.add("subscriptLoader", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"); this.add("tagging", "@mozilla.org/browser/tagging-service;1", "nsITaggingService"); + this.add("tld", "@mozilla.org/network/effective-tld-service;1", "nsIEffectiveTLDService"); this.add("threading", "@mozilla.org/thread-manager;1", "nsIThreadManager"); this.add("urifixup", "@mozilla.org/docshell/urifixup;1", "nsIURIFixup"); this.add("versionCompare", "@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator"); From a52a0dc61f0cb0184b209c897128bdf9fa63d48c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 1 Apr 2011 10:12:47 +1100 Subject: [PATCH 15/33] More ad hoc i18n work. --- common/content/abbreviations.js | 4 +- common/content/bookmarks.js | 2 +- common/content/buffer.js | 6 +-- common/content/editor.js | 2 +- common/content/marks.js | 2 +- common/content/mow.js | 8 ++-- common/content/tabs.js | 8 ++-- common/locale/en-US/messages.properties | 59 ++++++++++++++----------- common/modules/addons.jsm | 10 ++--- common/modules/commands.jsm | 4 +- common/modules/highlight.jsm | 2 +- common/modules/io.jsm | 2 +- common/modules/options.jsm | 2 +- common/modules/prefs.jsm | 2 +- common/modules/sanitizer.jsm | 2 +- common/modules/util.jsm | 4 +- melodactyl/content/player.js | 2 +- 17 files changed, 65 insertions(+), 56 deletions(-) diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index 4314abe9..ccc666e8 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -224,7 +224,7 @@ var Abbreviations = Module("abbreviations", { // TODO: Move this to an ItemList to show this automatically if (list.*.length() === list.text().length() + 2) - dactyl.echomsg(_("abbrev.none")); + dactyl.echomsg(_("abbreviation.none")); else commandline.commandOutput(list); } @@ -301,7 +301,7 @@ var Abbreviations = Module("abbreviations", { if (args.bang) args["-group"].clear(modes); else if (!args["-group"].remove(modes, args[0])) - return dactyl.echoerr(_("abbrev.noSuch")); + return dactyl.echoerr(_("abbreviation.noSuch")); }, { argCount: "?", bang: true, diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index ced48c6e..65691e1f 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -511,7 +511,7 @@ var Bookmarks = Module("bookmarks", { function (resp) { if (resp && resp.match(/^y(es)?$/i)) { bookmarks.remove(Object.keys(bookmarkcache.bookmarks)); - dactyl.echomsg(_("bookmark.allGone")); + dactyl.echomsg(_("bookmark.allDeleted")); } }); else { diff --git a/common/content/buffer.js b/common/content/buffer.js index dd42d7df..161a09d5 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -607,7 +607,7 @@ var Buffer = Module("buffer", { try { window.urlSecurityCheck(uri.spec, doc.nodePrincipal); - io.CommandFileMode(/*L*/"Save link: ", { + io.CommandFileMode(_("buffer.prompt.saveLink") + " ", { onSubmit: function (path) { let file = io.File(path); if (file.exists() && file.isDirectory()) @@ -1284,7 +1284,7 @@ var Buffer = Module("buffer", { // FIXME: arg handling is a bit of a mess, check for filename dactyl.assert(!arg || arg[0] == ">" && !util.OS.isWindows, - _("error.trailing")); + _("error.trailingCharacters")); prefs.withContext(function () { if (arg) { @@ -1463,7 +1463,7 @@ var Buffer = Module("buffer", { level = Math.constrain(level, Buffer.ZOOM_MIN, Buffer.ZOOM_MAX); } else - dactyl.assert(false, _("error.trailing")); + dactyl.assert(false, _("error.trailingCharacters")); buffer.setZoom(level, args.bang); }, diff --git a/common/content/editor.js b/common/content/editor.js index 86b8440c..3fd78fbe 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -243,7 +243,7 @@ var Editor = Module("editor", { let args = options.get("editor").format(args); - dactyl.assert(args.length >= 1, _("editor.noEditor")); + dactyl.assert(args.length >= 1, _("option.notSet", "editor")); io.run(args.shift(), args, blocking); }, diff --git a/common/content/marks.js b/common/content/marks.js index fc63bc83..1cb3e957 100644 --- a/common/content/marks.js +++ b/common/content/marks.js @@ -249,7 +249,7 @@ var Marks = Module("marks", { "Mark current location within the web page", function (args) { let mark = args[0] || ""; - dactyl.assert(mark.length <= 1, _("error.trailing")); + dactyl.assert(mark.length <= 1, _("error.trailingCharacters")); dactyl.assert(/[a-zA-Z]/.test(mark), _("mark.invalid")); marks.add(mark); diff --git a/common/content/mow.js b/common/content/mow.js index 51e55076..4e8c0b88 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -53,16 +53,16 @@ var MOW = Module("mow", { diff --git a/common/content/tabs.js b/common/content/tabs.js index f22e2b53..5c82b2bb 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -678,7 +678,7 @@ var Tabs = Module("tabs", { if (/^\d+$/.test(arg)) tabs.select("-" + arg, true); else - dactyl.echoerr(_("error.trailing")); + dactyl.echoerr(_("error.trailingCharacters")); } else if (count > 0) tabs.select("-" + count, true); @@ -701,7 +701,7 @@ var Tabs = Module("tabs", { // count is ignored if an arg is specified, as per Vim if (arg) { - dactyl.assert(/^\d+$/.test(arg), _("error.trailing")); + dactyl.assert(/^\d+$/.test(arg), _("error.trailingCharacters")); index = arg - 1; } else @@ -770,7 +770,7 @@ var Tabs = Module("tabs", { // FIXME: tabmove! N should probably produce an error dactyl.assert(!arg || /^([+-]?\d+)$/.test(arg), - _("error.trailing")); + _("error.trailingCharacters")); // if not specified, move to after the last tab tabs.move(config.tabbrowser.mCurrentTab, arg || "$", args.bang); @@ -825,7 +825,7 @@ var Tabs = Module("tabs", { "Attach the current tab to another window", function (args) { dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), - _("error.trailing")); + _("error.trailingCharacters")); let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1]; diff --git a/common/locale/en-US/messages.properties b/common/locale/en-US/messages.properties index 6e6ddd28..63d1a130 100644 --- a/common/locale/en-US/messages.properties +++ b/common/locale/en-US/messages.properties @@ -1,13 +1,12 @@ # TODO: normalize this debacle of Vim legacy messages -# : are we losing the error code prefixes? --djk -abbrev.noSuch = No such abbreviation -abbrev.none = No abbreviations found +abbreviation.noSuch = No such abbreviation +abbreviation.none = No abbreviations found addon.check-1 = Checking updates for addons: %S addon.cantInstallDir-1 = Cannot install a directory: %S addon.unavailable = Don't have add-on yet -addon.uknownCommand = Unknown command +addon.unknownCommand = Unknown command addon.commandNotAllowed = Command not allowed addon.installingUpdates-1 = Installing updates for addons: %S addon.noUpdates = No addon updates found @@ -15,9 +14,9 @@ addon.error-3 = Add-on %S %S: %S addon.action.On = On  addon.action.Off = Off -addon.action.Del = Del -addon.action.Upd = Upd -addon.action.Opt = Opt +addon.action.Delete = Del +addon.action.Update = Upd +addon.action.Options = Opt AddonManager.ERROR_NETWORK_FAILURE = A network error occurred AddonManager.ERROR_INCORRECT_HASH = The downloaded file did not match the expected hash @@ -35,12 +34,13 @@ bookmark.noMatchingTags-1 = No bookmarks matching tags %S bookmark.noMatchingString-1 = No bookmarks matching string %S bookmark.none = No bookmarks set bookmark.cantAdd-1 = Could not add bookmark %S -bookmark.allGone = All bookmarks deleted +bookmark.allDeleted = All bookmarks deleted bookmark.removed-1 = Removed bookmark: %S bookmark.added-1 = Added bookmark: %S bookmark.deleted-1 = %S bookmark(s) deleted bookmark.prompt.deleteAll = This will delete all bookmarks. Would you like to continue? (yes/[no]): +# TODO: add plurals support buffer.fewerTab-1 = %S fewer tab buffer.fewerTabs-1 = %S fewer tabs buffer.cantDetatchLast = Can't detach the last tab @@ -50,12 +50,15 @@ buffer.noClosed = No matching closed tab buffer.noAlternate = No alternate page buffer.backgroundLoaded = Background tab loaded: %S +# TODO: categorise these buffer.noTitle = [No Title] buffer.noName = [No Name] buffer.help = [Help] buffer.bookmarked = bookmarked + buffer.prompt.uploadFile = Upload file: +buffer.prompt.saveLink = Save link: context.scriptGroup-1 = Script group for %S @@ -84,18 +87,18 @@ command.noBang = E477: No ! allowed command.colorscheme.notFound-1 = E185: Cannot find color scheme %S command.conditional.illegal = Invalid use of conditional command.finish.illegal = E168: :finish used outside of a sourced file -command.let.noSuch-1 = E108: No such variable: %S -command.let.unexpectedChar = E18: Unexpected characters in :let command.let.illegalVar-1 = E461: Illegal variable name: %S -command.let.undefinedVar-1 = E121: Undefined variable: %S command.let.invalidExpression-1 = E15: Invalid expression: %S -command.yank.yankedLine-1 = Yanked %S line -command.yank.yankedLines-1 = Yanked %S lines +command.let.noSuch-1 = E108: No such variable: %S +command.let.undefinedVar-1 = E121: Undefined variable: %S +command.let.unexpectedChar = E18: Unexpected characters in :let command.run.noPrevious = E34: No previous command command.sanitize.privateMode = Cannot sanitize items in private mode -command.set.numberRequired-2 = E521: Number required after =: %S=%S command.set.errorParsing-1 = Error parsing :set command: %S +command.set.numberRequired-2 = E521: Number required after =: %S=%S command.set.unknownOption-1 = E518: Unknown option: %S +command.yank.yankedLine-1 = Yanked %S line +command.yank.yankedLines-1 = Yanked %S lines completion.waitingFor-1 = Waiting for %S completion.waitingForKeyPress = Waiting for key press @@ -117,9 +120,9 @@ dactyl.yank-1 = Yank %S dialog.notAvailable-1 = Dialog %S not available # TODO: merge with addon.*? -download.uknownCommand = Unknown command +download.unknownCommand = Unknown command download.commandNotAllowed = Command not allowed -download.prompt.launchExternal = This will launch an executable download. Would you like to continue? (yes/[no]/always): +download.prompt.launchExecutable = This will launch an executable download. Would you like to continue? (yes/[no]/always): download.action.Pause = Pause download.action.Remove = Remove @@ -128,7 +131,6 @@ download.action.Retry = Retry download.action.Cancel = Cancel download.action.Delete = Delete -editor.noEditor = No editor specified editor.prompt.editPassword = Editing a password field externally will reveal the password. Would you like to continue? (yes/[no]): emenu.notFound-1 = Menu not found: %S @@ -173,6 +175,7 @@ io.notInRTP-1 = not found in 'runtimepath': %S io.searchingFor-1 = Searching for %S io.searchingFor-2 = Searching for %S in %S io.downloadFinished-2 = Download of %S to %S finished +io.shellReturn-1 = shell returned %S macro.canceled-1 = Canceled playback of macro '%S' macro.recorded-1 = Recorded macro '%S' @@ -206,24 +209,30 @@ mow.continue = Press ENTER or type command to continue mow.more = -- More -- mow.moreHelp = -- More -- SPACE//j: screen/page/line down, //k: up, q: quit +mow.contextMenu.copyLink = Copy Link Location +mow.contextMenu.copyPath = Copy File Path +mow.contextMenu.copy = Copy +mow.contextMenu.selectAll = Select All + option.noSuch = No such option option.noSuch-1 = No such option: %S option.replaceExisting-1 = Warning: %S already exists: replacing existing option option.intRequired = Integer value required option.operatorNotSupported-2 = Operator %S not supported for option type %S +option.notSet-1 = E764: Option '%S' is not set option.currentValue = Current Value option.defaultValue = Default Value option.bufferLocal = buffer local +option.activate.safeSet = See the 'activate' option. +option.guioptions.safeSet = See 'guioptions' scrollbar flags. +option.hintkeys.duplicate = Duplicate keys not allowed # The string 'passkeys' must appear exactly, including U0027 apostrophes option.passkeys.passedBy = passed by 'passkeys' -option.hintkeys.duplicate = Duplicate keys not allowed -option.showtabline.safeSet = See 'showtabline' option. -option.activate.safeSet = See the 'activate' option. option.popups.safeSet = See the 'activate' option. -option.guioptions.safeSet = See 'guioptions' scrollbar flags. +option.showtabline.safeSet = See 'showtabline' option. option.visualbell.safeSet = See 'visualbell' option. pageinfo.s.ownerUnverified = %S (unverified) @@ -271,8 +280,8 @@ error.error-1 = Error: %S error.interrupted = Interrupted error.invalidSort-1 = Invalid sort order: %S error.missingQuote-1 = E114: Missing quote: %S -error.trailing = Trailing characters -error.trailing-1 = Trailing characters: %S +error.trailingCharacters = Trailing characters +error.trailingCharacters-1 = Trailing characters: %S error.invalid-1 = Invalid %S error.invalidArgument = Invalid argument error.invalidArgument-1 = Invalid argument: %S @@ -283,8 +292,8 @@ error.invalidOperation = Invalid operation error.monkeyPatchOverlay-1 = Not replacing property with eval-generated overlay by %S error.nullComputedStyle-1 = Computed style is null: %S error.syntaxError = Syntax error -error.charsOutsideRange-1 = Character list outside the range %S -error.invalidCharRange = Invalid character range: %S +error.charactersOutsideRange-1 = Character list outside the range %S +error.invalidCharacterRange = Invalid character range: %S error.notWriteable-2 = Could not write to %S: %S warn.deprecated-2 = %S is deprecated: Please use %S instead. diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 2d584911..58458c71 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -110,7 +110,7 @@ var actions = { name: "extr[ehash]", description: "Reload an extension", action: function (addon) { - util.assert(util.haveGecko("2b"), _("error.notUseful", config.host)); + util.assert(util.haveGecko("2b"), _("command.notUseful", config.host)); util.timeout(function () { addon.userDisabled = true; addon.userDisabled = false; @@ -153,9 +153,9 @@ var Addon = Class("Addon", {

, @@ -418,7 +418,7 @@ var Addons = Module("addons", { function (args) { let name = args[0]; if (args.bang && !command.bang) - dactyl.assert(!name, _("error.trailing")); + dactyl.assert(!name, _("error.trailingCharacters")); else dactyl.assert(name, _("error.argumentRequired")); diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 3c60ad87..e27e7b5e 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -310,7 +310,7 @@ var Command = Class("Command", { util.assert((this.length == 0 || this.command.argCount !== "0") && (this.length <= 1 || !/^[01?]$/.test(this.command.argCount)), - _("error.trailing")); + _("error.trailingCharacters")); } } }); @@ -863,7 +863,7 @@ var Commands = Module("commands", { let [count, arg, quote] = Commands.parseArg(str, null, _keepQuotes); if (quote == "\\" && !complete) - return [, , , _("error.trailing", "\\")]; + return [, , , _("error.trailingCharacters", "\\")]; if (quote && !complete) return [, , , _("error.missingQuote", quote)]; return [count, arg, quote]; diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm index 37d769d5..6142cce5 100644 --- a/common/modules/highlight.jsm +++ b/common/modules/highlight.jsm @@ -337,7 +337,7 @@ var Highlights = Module("Highlight", { if (!modify && /&$/.test(key)) [clear, modify, key] = [true, true, key.replace(/&$/, "")]; - dactyl.assert(!(clear && css), _("error.trailing")); + dactyl.assert(!(clear && css), _("error.trailingCharacters")); if (!modify) modules.commandline.commandOutput( diff --git a/common/modules/io.jsm b/common/modules/io.jsm index edf378d0..5dd2b2fb 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -831,7 +831,7 @@ unlet s:cpo_save let result = io.system(arg); if (result.returnValue != 0) - result.output += /*L*/"\nshell returned " + result.returnValue; + result.output += "\n" + _("io.shellReturn", result.returnValue); modules.commandline.command = "!" + arg; modules.commandline.commandOutput({result.output}); diff --git a/common/modules/options.jsm b/common/modules/options.jsm index e856cd4e..56f0e899 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -1169,7 +1169,7 @@ var Options = Module("options", { context.advance(context.filter.indexOf("=")); if (option.type == "boolean") - return error(context.filter.length, _("error.trailing")); + return error(context.filter.length, _("error.trailingCharacters")); context.advance(1); if (opt.error) diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm index 6837f735..1fa898b2 100644 --- a/common/modules/prefs.jsm +++ b/common/modules/prefs.jsm @@ -288,7 +288,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) */ toggle: function (name) { util.assert(this.branch.getPrefType(name) === Ci.nsIPrefBranch.PREF_BOOL, - _("error.trailing", name + "!")); + _("error.trailingCharacters", name + "!")); this.set(name, !this.get(name)); }, diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 837a9a6b..b7b3fe61 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -416,7 +416,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef args[0] = "all"; if (args.bang) { - dactyl.assert(args.length == 0, _("error.trailing")); + dactyl.assert(args.length == 0, _("error.trailingCharacters")); items = Object.keys(sanitizer.itemMap).filter( function (k) modules.options.get("sanitizeitems").has(k)); } diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 989f6ef1..16f9b0b6 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -182,12 +182,12 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), // check for chars not in the accepted range this.assert(RegExp("^[" + accepted + "-]+$").test(list), - _("error.charsOutsideRange", accepted.quote())); + _("error.charactersOutsideRange", accepted.quote())); // check for illegal ranges for (let [match] in this.regexp.iterate(/.-./g, list)) this.assert(match.charCodeAt(0) <= match.charCodeAt(2), - _("error.invalidCharRange", list.slice(list.indexOf(match)))); + _("error.invalidCharacterRange", list.slice(list.indexOf(match)))); return RegExp("[" + util.regexp.escape(list) + "]"); }, diff --git a/melodactyl/content/player.js b/melodactyl/content/player.js index 3bed2ed0..5609a301 100644 --- a/melodactyl/content/player.js +++ b/melodactyl/content/player.js @@ -661,7 +661,7 @@ const Player = Module("player", { let arg = args[0]; dactyl.assert(arg, _("error.argumentRequired")); - dactyl.assert(/^[+-]?\d+$/.test(arg), _("error.trailing")); + dactyl.assert(/^[+-]?\d+$/.test(arg), _("error.trailingCharacters")); let level = parseInt(arg, 10) / 100; From b181d7164f5c1a81372af55143bc54a24fb6307e Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 1 Apr 2011 18:20:58 -0400 Subject: [PATCH 16/33] Add Find highlight group. --- common/content/commandline.js | 5 ++--- common/locale/en-US/styling.xml | 1 + common/modules/config.jsm | 24 +++++++++++++++++++++++- common/modules/highlight.jsm | 2 ++ common/modules/util.jsm | 2 +- pentadactyl/NEWS | 1 + 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 611e2669..5a8ffdae 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -648,10 +648,9 @@ var CommandLine = Module("commandline", { * @param {XML} xml The output as an E4X XML object. */ commandOutput: function commandOutput(xml) { - XML.ignoreWhitespace = false; - XML.prettyPrinting = false; + XML.ignoreWhitespace = XML.prettyPrinting = false; if (this.command) - this.echo(<>:{this.command}{xml}, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); + this.echo(<>
:{this.command}
{xml}, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); else this.echo(xml, this.HIGHLIGHT_NORMAL, this.FORCE_MULTILINE); this.command = null; diff --git a/common/locale/en-US/styling.xml b/common/locale/en-US/styling.xml index eda39bbf..ff3c7017 100644 --- a/common/locale/en-US/styling.xml +++ b/common/locale/en-US/styling.xml @@ -79,6 +79,7 @@
Enabled
Text indicating enabled status, such as of an extension or style group
ErrorMsg
Error messages
Filter
The matching text in a completion list
+
Find
Text find highlighting. Only background and foreground colors apply.
FrameIndicator
The indicator shown when a new frame is selected
Function
A JavaScript Function object
Hint
A hint indicator. See :help hints
diff --git a/common/modules/config.jsm b/common/modules/config.jsm index bc67e657..4812eb82 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -13,7 +13,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("config", { exports: ["ConfigBase", "Config", "config"], require: ["services", "storage", "util", "template"], - use: ["io", "messages", "prefs"] + use: ["io", "messages", "prefs", "styles"] }, this); var ConfigBase = Class("ConfigBase", { @@ -33,9 +33,12 @@ var ConfigBase = Class("ConfigBase", { loadStyles: function loadStyles() { const { highlight } = require("highlight"); + highlight.styleableChrome = this.styleableChrome; + highlight.loadCSS(this.CSS); highlight.loadCSS(this.helpCSS); + if (!util.haveGecko("2b")) highlight.loadCSS(); + + let hl = highlight.set("Find", ""); + hl.onChange = function () { + function hex(val) ("#" + util.regexp.iterate(/\d+/g, val) + .map(function (num) ("0" + Number(num).toString(16)).slice(-2)) + .join("") + ).slice(0, 7); + + let elem = services.appShell.hiddenDOMWindow.document.createElement("div"); + elem.style.cssText = this.cssText; + let style = util.computedStyle(elem); + + let keys = iter(Styles.propertyIter(this.cssText)).map(function (p) p.name).toArray(); + let bg = keys.some(function (k) /^background/.test(k)); + let fg = keys.indexOf("color") >= 0; + + prefs[bg ? "safeSet" : "safeReset"]("ui.textHighlightBackground", hex(style.backgroundColor)); + prefs[fg ? "safeSet" : "safeReset"]("ui.textHighlightForeground", hex(style.color)); + }; }, get addonID() this.name + "@dactyl.googlecode.com", diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm index 6142cce5..02020afc 100644 --- a/common/modules/highlight.jsm +++ b/common/modules/highlight.jsm @@ -33,6 +33,8 @@ Highlight.liveProperty = function (name, prop) { h.style.css = h.css; this.style[prop || name] = this[prop || name]; + if (this.onChange) + this.onChange(); }); } Highlight.liveProperty("agent"); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 16f9b0b6..0a64fd2f 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -1694,7 +1694,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), do { mainThread.processNextEvent(!flush); if (util.interrupted) - throw new Error("Interrupted"); + throw Error("Interrupted"); } while (flush === true && mainThread.hasPendingEvents()); } diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS index 79321c2d..5aca053c 100644 --- a/pentadactyl/NEWS +++ b/pentadactyl/NEWS @@ -134,6 +134,7 @@ - CSS property name completion is now available. [b4] - :delstyle, :styleenable, :styledisable and :styletoggle accept a ! to operate on all styles. [b6] + - Added Find group. [b7] • IMPORTANT option changes: - Option value quoting has changed. List options will no longer be split at quoted commas and the option name, From 78cf60a5bac69ac732112750e4d50691dce5cc20 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 1 Apr 2011 21:32:29 +1100 Subject: [PATCH 17/33] Fix typo in :help :sanitize. --HG-- extra : rebase_source : ae66821a8b9824a006d8d47350fb32367de9cb86 --- common/locale/en-US/privacy.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/locale/en-US/privacy.xml b/common/locale/en-US/privacy.xml index 84dafa98..06bcdc2c 100644 --- a/common/locale/en-US/privacy.xml +++ b/common/locale/en-US/privacy.xml @@ -92,7 +92,7 @@ The following items are always cleared entirely, regardless of - timeframe: cache, host, offlineapps, + timespan: cache, host, offlineapps, passwords, sessions, sitesettings. Conversely, host and options are never cleared unless a host is specified. From 94c8b3f1b83a7ac319d0c2c6a7556e292f33bff1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 3 Apr 2011 02:14:15 +1100 Subject: [PATCH 18/33] Add cheap interactive :js heredoc sanity test. --HG-- extra : rebase_source : 8a14101f288c46ae0f87810b31ffba04a80222e4 --- common/tests/functional/testCommands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tests/functional/testCommands.js b/common/tests/functional/testCommands.js index d317cbf6..e247359e 100644 --- a/common/tests/functional/testCommands.js +++ b/common/tests/functional/testCommands.js @@ -301,7 +301,7 @@ var tests = { }, if: {}, // Skip for now javascript: { - noOutput: ["''", "'\\n'", "
foo bar
", "window"], + noOutput: ["''", "'\\n'", "
foo bar
", "window", "< Date: Mon, 4 Apr 2011 22:09:05 +1000 Subject: [PATCH 19/33] Fix :command [arg]. In a manner roughly analogous to the :map [arg] implementation. Closes issue #455. --- common/modules/commands.jsm | 76 ++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index e27e7b5e..bb184933 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -640,47 +640,55 @@ var Commands = Module("commands", { /** * Displays a list of user-defined commands. + * + * @param {string} filter Limits the list to those commands with a name + * matching this anchored substring. */ - list: function list() { + list: function list(filter) { const { commandline, completion } = this.modules; function completerToString(completer) { if (completer) return [k for ([k, v] in Iterator(config.completers)) if (completer == completion.closure[v])][0] || "custom"; return ""; } + // TODO: allow matching of aliases? + function cmds(hive) hive._list.filter(function (cmd) cmd.name.indexOf(filter || "") == 0) - if (!this.userHives.some(function (h) h._list.length)) + let hives = this.userHives.map(function (h) [h, cmds(h)]).filter(function ([h, c]) c.length); + + let list =
jumptitleURIJumpTitleURI
{c} {_("addon.action.On")} {_("addon.action.Off")} - {_("addon.action.Del")} - {_("addon.action.Upd")} - {_("addon.action.Opt")} + {_("addon.action.Delete")} + {_("addon.action.Update")} + {_("addon.action.Options")}
+ + + + + + + + + + { + template.map(hives, function ([hive, cmds]) let (i = 0) + + + template.map(cmds, function (cmd) + template.map(cmd.names, function (name) + + + + + + + + + )) + + ) + } +
+ NameArgsRangeCompleteDefinition
{!i++ ? hive.name : ""}{cmd.bang ? "!" : " "}{cmd.name}{cmd.argCount}{cmd.count ? "0c" : ""}{completerToString(cmd.completer)}{cmd.replacementText || "function () { ... }"}
; + + if (list.*.length() === list.text().length() + 2) dactyl.echomsg(_("command.none")); else - commandline.commandOutput( - - - - - - - - - - - { - template.map(this.userHives, function (hive) let (i = 0) - + - template.map(hive, function (cmd) - template.map(cmd.names, function (name) - - - - - - - - - )) + - ) - } -
- NameArgsRangeCompleteDefinition
{!i++ ? hive.name : ""}{cmd.bang ? "!" : " "}{cmd.name}{cmd.argCount}{cmd.count ? "0c" : ""}{completerToString(cmd.completer)}{cmd.replacementText || "function () { ... }"}
); + commandline.commandOutput(list); } }), @@ -1382,8 +1390,6 @@ var Commands = Module("commands", { commands: function initCommands(dactyl, modules, window) { const { commands, contexts } = modules; - // TODO: Vim allows commands to be defined without {rep} if there are {attr}s - // specified - useful? commands.add(["com[mand]"], "List or define commands", function (args) { @@ -1392,8 +1398,8 @@ var Commands = Module("commands", { util.assert(!cmd || cmd.split(",").every(commands.validName.closure.test), _("command.invalidName", cmd)); - if (!args.literalArg) - commands.list(); + if (args.length <= 1) + commands.list(cmd); else { util.assert(args["-group"].modifiable, _("group.cantChangeBuiltin", _("command.commands"))); From 8ef77adb1c5735b28301ac348c44399b8a24c24d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 4 Apr 2011 22:10:28 +1000 Subject: [PATCH 20/33] Whitespace fixes. --- common/content/events.js | 2 +- common/content/hints.js | 2 +- common/content/mow.js | 6 +++--- common/modules/base.jsm | 4 ++-- common/modules/config.jsm | 5 ----- common/modules/io.jsm | 2 +- common/tests/functional/testOptions.js | 2 +- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 3b8b042d..5997d70f 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -322,7 +322,7 @@ var EventHive = Class("EventHive", Contexts.Hive, { var [self, events] = [null, array.toObject([[event, callback]])]; else { [self, events] = [event, event[callback || "events"]]; - [,, capture, allowUntrusted] = arguments; + [, , capture, allowUntrusted] = arguments; } if (set.has(events, "input") && !set.has(events, "dactyl-input")) diff --git a/common/content/hints.js b/common/content/hints.js index e89f334d..cc59d101 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -472,7 +472,7 @@ var HintSession = Class("HintSession", CommandMode, { else if (n) hints.setClass(elem, n % 2); else - hints.setClass(elem, this.validHints[Math.max(0, this.hintNumber-1)].elem === elem); + hints.setClass(elem, this.validHints[Math.max(0, this.hintNumber - 1)].elem === elem); if (n--) this.timeout(next, 50); diff --git a/common/content/mow.js b/common/content/mow.js index 4e8c0b88..da00d220 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -278,11 +278,11 @@ var MOW = Module("mow", { let elem = this.widget.contentDocument.documentElement; if (showHelp) - this.widgets.message = ["MoreMsg", _("mow.moreHelp")]; + this.widgets.message = ["MoreMsg", _("mow.moreHelp")]; else if (force || (options["more"] && Buffer.isScrollable(elem, 1))) - this.widgets.message = ["MoreMsg", _("mow.more")]; + this.widgets.message = ["MoreMsg", _("mow.more")]; else - this.widgets.message = ["Question", _("mow.continue")]; + this.widgets.message = ["Question", _("mow.continue")]; }, visible: Modes.boundProperty({ diff --git a/common/modules/base.jsm b/common/modules/base.jsm index a57f04ed..55782966 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -205,7 +205,7 @@ function require(obj, name, from) { if (loaded.util) util.reportError(e); else - defineModule.dump(" " + (e.filename || e.fileName) + ":" + e.lineNumber + ": " + e +"\n"); + defineModule.dump(" " + (e.filename || e.fileName) + ":" + e.lineNumber + ": " + e + "\n"); } } @@ -216,7 +216,7 @@ defineModule("base", { "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMUtils", "XPCSafeJSObjectWrapper", "array", "bind", "call", "callable", "ctypes", "curry", "debuggerProperties", "defineModule", "deprecated", "endModule", "forEach", "isArray", "isGenerator", "isinstance", "isObject", - "isString", "isSubclass", "iter", "iterAll", "iterOwnProperties","keys", "memoize", "octal", + "isString", "isSubclass", "iter", "iterAll", "iterOwnProperties", "keys", "memoize", "octal", "properties", "require", "set", "update", "values", "withCallerGlobal" ], use: ["config", "services", "util"] diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 4812eb82..07a49de5 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -450,7 +450,6 @@ var ConfigBase = Class("ConfigBase", { CmdInput;.dactyl-commandline-command CmdOutput white-space: pre; - CompGroup CompGroup:not(:first-of-type) margin-top: .5em; CompGroup:last-of-type padding-bottom: 1.5ex; @@ -478,10 +477,8 @@ var ConfigBase = Class("ConfigBase", { CompMore text-align: center; height: .5ex; line-height: .5ex; margin-bottom: -.5ex; CompMore::after content: "⌄"; - Dense margin-top: 0; margin-bottom: 0; - EditorEditing;;* background: #bbb !important; -moz-user-input: none !important; -moz-user-modify: read-only !important; EditorError;;* background: red !important; EditorBlink1;;* background: yellow !important; @@ -686,7 +683,6 @@ var ConfigBase = Class("ConfigBase", { HelpList;html|ul;dactyl://help/* display: block; list-style-position: outside; margin: 1em 0; HelpListItem;html|li;dactyl://help/* display: list-item; - HelpNote color: red; font-weight: bold; HelpOpt;;;FontCode color: #106326; @@ -733,7 +729,6 @@ var ConfigBase = Class("ConfigBase", { HelpHead4;html|h4;dactyl://help/* { } - HelpTab;html|dl;dactyl://help/* { display: table; width: 100%; diff --git a/common/modules/io.jsm b/common/modules/io.jsm index 5dd2b2fb..bd7b955a 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -116,7 +116,7 @@ var IO = Module("io", { outer: for (let dir in values(dirs)) { - for (let [,path] in Iterator(paths)) { + for (let [, path] in Iterator(paths)) { let file = dir.child(path); dactyl.echomsg(_("io.searchingFor", file.path.quote()), 3); diff --git a/common/tests/functional/testOptions.js b/common/tests/functional/testOptions.js index c268743b..89301320 100644 --- a/common/tests/functional/testOptions.js +++ b/common/tests/functional/testOptions.js @@ -31,7 +31,7 @@ var options = {}; function testCompleters() { for (var option in dactyl.modules.options) - for (var [,value] in Iterator([""].concat(options[option.name] || []))) { + for (var [, value] in Iterator([""].concat(options[option.name] || []))) { dump("OPT COMP " + option.name + " " + value + "\n"); dactyl.testCompleter(option, "completer", value, "Option '" + option.name + "' completer failed"); } From d960ede32e0a5b19eceeb32ffaaeb64159fd9cef Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 4 Apr 2011 22:11:30 +1000 Subject: [PATCH 21/33] Display a message from :scriptnames when no scripts have been sourced. --- common/locale/en-US/messages.properties | 1 + common/modules/io.jsm | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/locale/en-US/messages.properties b/common/locale/en-US/messages.properties index 63d1a130..88779c3d 100644 --- a/common/locale/en-US/messages.properties +++ b/common/locale/en-US/messages.properties @@ -94,6 +94,7 @@ command.let.undefinedVar-1 = E121: Undefined variable: %S command.let.unexpectedChar = E18: Unexpected characters in :let command.run.noPrevious = E34: No previous command command.sanitize.privateMode = Cannot sanitize items in private mode +command.scriptnames.none = No sourced scripts found command.set.errorParsing-1 = Error parsing :set command: %S command.set.numberRequired-2 = E521: Number required after =: %S=%S command.set.unknownOption-1 = E518: Unknown option: %S diff --git a/common/modules/io.jsm b/common/modules/io.jsm index bd7b955a..f5af1188 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -783,9 +783,13 @@ unlet s:cpo_save commands.add(["scrip[tnames]"], "List all sourced script names", function () { - modules.commandline.commandOutput( - template.tabular(["", "Filename"], ["text-align: right; padding-right: 1em;"], - ([i + 1, file] for ([i, file] in Iterator(io._scriptNames))))); // TODO: add colon and remove column titles for pedantic Vim compatibility? + if (!io._scriptNames.length) + dactyl.echomsg(_("command.scriptnames.none")); + else + modules.commandline.commandOutput( + template.tabular(["", "Filename"], ["text-align: right; padding-right: 1em;"], + ([i + 1, file] for ([i, file] in Iterator(io._scriptNames))))); // TODO: add colon and remove column titles for pedantic Vim compatibility? + }, { argCount: "0" }); From 2dd8c8889864036d578926c4fcb765d6bec4f7d2 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 4 Apr 2011 20:39:44 -0400 Subject: [PATCH 22/33] Fix beep when starting REPL mode. --- common/content/modes.js | 9 ++++++--- common/modules/javascript.jsm | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common/content/modes.js b/common/content/modes.js index bdac8a26..f9b93625 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -446,19 +446,22 @@ var Modes = Module("modes", { while (this._modeStack.length > 1 && this.main != mode) { let a = this._modeStack.pop(); this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params, - update({ pop: a }, args || {})); + update({ pop: a }, + args || {})); if (mode == null) return; } }, - replace: function replace(mode, oldMode) { + replace: function replace(mode, oldMode, args) { while (oldMode && this._modeStack.length > 1 && this.main != oldMode) this.pop(); if (this._modeStack.length > 1) - this.set(mode, null, null, { push: this.topOfStack, pop: this._modeStack.pop() }); + this.set(mode, null, null, + update({ push: this.topOfStack, pop: this._modeStack.pop() }, + args || {})); this.push(mode); }, diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index 981ec418..6ff0d5e7 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -791,12 +791,12 @@ var JavaScript = Module("javascript", { this.repl = REPL(this.context); }, open: function open(context) { - this.updatePrompt(); modules.mow.echo(this.repl); this.widgets.message = null; open.superapply(this, arguments); + this.updatePrompt(); }, complete: function complete(context) { From 8f996c79bd92f7e9dddaf5bb3ce7fdd7cf992f2b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 4 Apr 2011 20:59:37 -0400 Subject: [PATCH 23/33] Move the completion list above the MOW in REPL mode. --- common/content/commandline.js | 27 +++++++++++++++------------ common/modules/javascript.jsm | 3 +++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 5a8ffdae..5a85a7d7 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -301,7 +301,7 @@ var CommandWidgets = Class("CommandWidgets", { }); var CommandMode = Class("CommandMode", { - init: function init() { + init: function CM_init() { this.keepCommand = userContext.hidden_option_command_afterimage; }, @@ -311,7 +311,7 @@ var CommandMode = Class("CommandMode", { get prompt() this.widgets.prompt, set prompt(val) this.widgets.prompt = val, - open: function (command) { + open: function CM_open(command) { dactyl.assert(isinstance(this.mode, modes.COMMAND_LINE), /*L*/"Not opening command line in non-command-line mode."); @@ -341,7 +341,7 @@ var CommandMode = Class("CommandMode", { get widgets() commandline.widgets, - enter: function (stack) { + enter: function CM_enter(stack) { commandline.commandSession = this; if (stack.pop && commandline.command) { this.onChange(commandline.command); @@ -350,7 +350,7 @@ var CommandMode = Class("CommandMode", { } }, - leave: function (stack) { + leave: function CM_leave(stack) { if (!stack.push) { commandline.commandSession = null; this.input.dactylKeyPress = undefined; @@ -375,7 +375,7 @@ var CommandMode = Class("CommandMode", { }, events: { - input: function onInput(event) { + input: function CM_onInput(event) { if (this.completions) { this.resetCompletions(); @@ -383,7 +383,7 @@ var CommandMode = Class("CommandMode", { } this.onChange(commandline.command); }, - keyup: function onKeyUp(event) { + keyup: function CM_onKeyUp(event) { let key = events.toString(event); if (/-?Tab>$/.test(key) && this.completions) this.completions.tabTimer.flush(); @@ -392,7 +392,7 @@ var CommandMode = Class("CommandMode", { keepCommand: false, - onKeyPress: function onKeyPress(events) { + onKeyPress: function CM_onKeyPress(events) { if (this.completions) this.completions.previewClear(); @@ -407,7 +407,7 @@ var CommandMode = Class("CommandMode", { onSubmit: function (value) {}, - resetCompletions: function resetCompletions() { + resetCompletions: function CM_resetCompletions() { if (this.completions) { this.completions.context.cancelAll(); this.completions.wildIndex = -1; @@ -426,11 +426,11 @@ var CommandExMode = Class("CommandExMode", CommandMode, { prompt: ["Normal", ":"], - complete: function complete(context) { + complete: function CEM_complete(context) { context.fork("ex", 0, completion, "ex"); }, - onSubmit: function onSubmit(command) { + onSubmit: function CEM_onSubmit(command) { contexts.withContext({ file: /*L*/"[Command Line]", line: 1 }, function _onSubmit() { io.withSavedValues(["readHeredoc"], function _onSubmit() { @@ -443,13 +443,13 @@ var CommandExMode = Class("CommandExMode", CommandMode, { }); var CommandPromptMode = Class("CommandPromptMode", CommandMode, { - init: function init(prompt, params) { + init: function CPM_init(prompt, params) { this.prompt = isArray(prompt) ? prompt : ["Question", prompt]; update(this, params); init.supercall(this); }, - complete: function (context) { + complete: function CPM_complete(context) { if (this.completer) context.forkapply("prompt", 0, this, "completer", Array.slice(arguments, 1)); }, @@ -586,6 +586,9 @@ var CommandLine = Module("commandline", { get completionList() { let node = this.widgets.active.commandline; + if (this.commandSession && this.commandSession.completionList) + node = document.getElementById(this.commandSession.completionList); + if (!node.completionList) { let elem = document.getElementById("dactyl-completions-" + node.id); util.waitFor(bind(this.widgets._ready, null, elem)); diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index 6ff0d5e7..43cab63c 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -790,6 +790,7 @@ var JavaScript = Module("javascript", { this.repl = REPL(this.context); }, + open: function open(context) { modules.mow.echo(this.repl); @@ -807,6 +808,8 @@ var JavaScript = Module("javascript", { mode: modes.REPL, + get completionList() this.widgets.statusbar.commandline.id, + accept: function accept() { dactyl.trapErrors(function () { this.repl.addOutput(this.command) }, this); From e926226437221477727861b9cafef8c816a1b880 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 4 Apr 2011 21:23:57 -0400 Subject: [PATCH 24/33] Fix issue with REPL completion with a wrappedJSObject context. --- common/modules/javascript.jsm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index 43cab63c..7d8de811 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -117,12 +117,8 @@ var JavaScript = Module("javascript", { return cache[key]; context[JavaScript.EVAL_TMP] = tmp; - context[JavaScript.EVAL_EXPORT] = function export_(obj) cache[key] = obj; try { - if (tmp != null) // Temporary hack until bug 609949 is fixed. - this.modules.dactyl.userEval(JavaScript.EVAL_EXPORT + "(" + arg + ")", context, /*L*/"[Command Line Completion]", 1); - else - cache[key] = this.modules.dactyl.userEval(arg, context, /*L*/"[Command Line Completion]", 1); + cache[key] = this.modules.dactyl.userEval(arg, context, /*L*/"[Command Line Completion]", 1); return cache[key]; } @@ -646,7 +642,6 @@ var JavaScript = Module("javascript", { }, { EVAL_TMP: "__dactyl_eval_tmp", - EVAL_EXPORT: "__dactyl_eval_export", /** * A map of argument completion functions for named methods. The From 476fe51cd330f167732a623a4cf6980f4137b27a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Apr 2011 00:33:47 -0400 Subject: [PATCH 25/33] Fix renaming issue. --- common/content/commandline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 5a85a7d7..5cf8a9bc 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -443,7 +443,7 @@ var CommandExMode = Class("CommandExMode", CommandMode, { }); var CommandPromptMode = Class("CommandPromptMode", CommandMode, { - init: function CPM_init(prompt, params) { + init: function init(prompt, params) { this.prompt = isArray(prompt) ? prompt : ["Question", prompt]; update(this, params); init.supercall(this); From 1741c1d7ac2de746871e8ab5f6c366d5dd96e115 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Apr 2011 00:41:00 -0400 Subject: [PATCH 26/33] Fix Minefield brokenness. --- common/modules/options.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/modules/options.jsm b/common/modules/options.jsm index 56f0e899..e002703c 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -448,7 +448,7 @@ var Option = Class("Option", { regexplist: function regexplist(k, default_) { for (let re in values(this.value)) - if (re(k)) + if ((re.test || re).call(re, k)) return re.result; return arguments.length > 1 ? default_ : null; }, From 4ac814d4f929b11c13f4d6e3395f352dff2d012c Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Apr 2011 17:26:00 -0400 Subject: [PATCH 27/33] =?UTF-8?q?Fix=20:version=20when=20running=20from=20?= =?UTF-8?q?hg=20on=20Windows=C2=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/modules/config.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 07a49de5..61766ad3 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -154,7 +154,7 @@ var ConfigBase = Class("ConfigBase", { */ VCSPath: Class.memoize(function () { if (/pre$/.test(this.addon.version)) { - let uri = this.addon.getResourceURI("../.hg"); + let uri = util.newURI(this.addon.getResourceURI("").spec + "../.hg"); if (uri instanceof Ci.nsIFileURL && uri.file.exists() && io.pathSearch("hg")) From 52b7a5364d77cea362f80f80f304a142449b681f Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Apr 2011 17:34:58 -0400 Subject: [PATCH 28/33] =?UTF-8?q?Fix=20Minefield=20button=20on=20Windows?= =?UTF-8?q?=C2=AE=20with=20Personas=20garbage=20installed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/content/events.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 5997d70f..bd21c653 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1490,14 +1490,16 @@ var Events = Module("events", { key === "" || key === "", isHidden: function isHidden(elem, aggressive) { - for (let e = elem; e instanceof Element; e = e.parentNode) { - if (util.computedStyle(e).visibility !== "visible" || - aggressive && !/set$/.test(e.localName) - && e.boxObject && e.boxObject.height === 0) - return true; - else if (e.namespaceURI == XUL && e.localName === "panel") - break; - } + if (util.computedStyle(elem).visibility !== "visible") + return true; + + if (aggressive) + for (let e = elem; e instanceof Element; e = e.parentNode) { + if (!/set$/.test(e.localName) && e.boxObject && e.boxObject.height === 0) + return true; + else if (e.namespaceURI == XUL && e.localName === "panel") + break; + } return false; }, From 3a9069f24d1a956ead1b0620c20288d62b7f2433 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Apr 2011 19:32:32 -0400 Subject: [PATCH 29/33] Make behave sensibly. --- common/content/events.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/events.js b/common/content/events.js index bd21c653..18f752a6 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1262,7 +1262,7 @@ var Events = Module("events", { else ignore = true; - if (ignore && !Events.isEscape(key)) + if (ignore) modes.pop(); } else if (!event.isMacro && !event.noremap && events.shouldPass(event)) From 5f141d26bd3e5bf66aa2d2eb2a9335547d081859 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Apr 2011 19:45:33 -0400 Subject: [PATCH 30/33] Fix some issues with ops on *map options. --- common/modules/options.jsm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/common/modules/options.jsm b/common/modules/options.jsm index e002703c..2c024a51 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -619,19 +619,24 @@ var Option = Class("Option", { stringlist: function stringlist(operator, values, scope, invert) { values = Array.concat(values); + function uniq(ary) { + let seen = {}; + return ary.filter(function (elem) !set.add(seen, elem)); + } + switch (operator) { case "+": - return array.uniq(Array.concat(this.value, values), true); + return uniq(Array.concat(this.value, values), true); case "^": // NOTE: Vim doesn't prepend if there's a match in the current value - return array.uniq(Array.concat(values, this.value), true); + return uniq(Array.concat(values, this.value), true); case "-": - return this.value.filter(function (item) values.indexOf(item) == -1); + return this.value.filter(function (item) !set.has(this, item), set(values)); case "=": if (invert) { - let keepValues = this.value.filter(function (item) values.indexOf(item) == -1); - let addValues = values.filter(function (item) this.value.indexOf(item) == -1, this); - return addValues.concat(keepValues); + let keepValues = this.value.filter(function (item) !set.has(this, item), set(values)); + let addValues = values.filter(function (item) !set.has(this, item), set(this.value)); + return this.parse(addValues.concat(keepValues)); } return values; } From dae5910c71f20d855274dfe5c978f45cbcd21aac Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Apr 2011 19:51:41 -0400 Subject: [PATCH 31/33] Fix silliness in last commit. --- common/modules/options.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/modules/options.jsm b/common/modules/options.jsm index 2c024a51..dc73558a 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -636,7 +636,7 @@ var Option = Class("Option", { if (invert) { let keepValues = this.value.filter(function (item) !set.has(this, item), set(values)); let addValues = values.filter(function (item) !set.has(this, item), set(this.value)); - return this.parse(addValues.concat(keepValues)); + return addValues.concat(keepValues); } return values; } From ef4070b384e8d20b2bf0e7ba9ee2ba8393954875 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 6 Apr 2011 17:47:54 -0400 Subject: [PATCH 32/33] Fix caret mode bindings in frameset pages. --- common/content/buffer.js | 4 +--- pentadactyl/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 161a09d5..cc2f1eae 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -579,9 +579,7 @@ var Buffer = Module("buffer", { * @property {nsISelectionController} The current document's selection * controller. */ - get selectionController() config.browser.docShell - .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsISelectionDisplay) - .QueryInterface(Ci.nsISelectionController), + get selectionController() util.selectionController(this.focusedFrame), /** * Opens the appropriate context menu for *elem*. diff --git a/pentadactyl/Makefile b/pentadactyl/Makefile index 810d7c4c..daf282e5 100644 --- a/pentadactyl/Makefile +++ b/pentadactyl/Makefile @@ -6,7 +6,7 @@ FIREFOX ?= firefox HOSTAPP ?= $(FIREFOX) PROFILEPATHS ?= "$$HOME/.mozilla/firefox" \ "$$HOME/Library/Application Support/Firefox" \ - "$$APPDATA/Mozilla/Firefox" \ - "$$AppData/Mozilla/Firefox" + "$$APPDATA/Mozilla/Firefox/Profiles" \ + "$$AppData/Mozilla/Firefox/Profiles" include ../common/Makefile From 909d89c5a6f7936588cc65071baf27f87c9c14e0 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 7 Apr 2011 13:29:54 -0400 Subject: [PATCH 33/33] Fix 'passkeys' on Minefield. --- common/content/events.js | 2 +- common/content/tabs.js | 5 ++++- common/modules/base.jsm | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 18f752a6..1f13aefa 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1665,7 +1665,7 @@ var Events = Module("events", { filter.keys = events.fromString(vals[0]).map(events.closure.toString); filter.commandKeys = vals.slice(1).map(events.closure.canonicalKeys); - filter.inputKeys = filter.commandKeys.filter(/^<[ACM]-/); + filter.inputKeys = filter.commandKeys.filter(bind("test", /^<[ACM]-/)); }); this.flush(); return values; diff --git a/common/content/tabs.js b/common/content/tabs.js index 5c82b2bb..cfc21aa9 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -266,7 +266,10 @@ var Tabs = Module("tabs", { let tabs = this.visibleTabs; let position = this.index(null, true); - if (spec == null || spec === "") + if (spec == null) + return -1; + + if (spec === "") return position; if (typeof spec === "number") diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 55782966..724dfb3c 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -473,9 +473,13 @@ function curry(fn, length, self, acc) { } if (curry.bind) - var bind = function bind(func) func.bind.apply(func, Array.slice(arguments, bind.length)); + var bind = function bind(meth, self) let (func = callable(meth) ? meth : self[meth]) + func.bind.apply(func, Array.slice(arguments, 1)); else var bind = function bind(func, self) { + if (!callable(func)) + func = self[func]; + let args = Array.slice(arguments, bind.length); return function bound() func.apply(self, args.concat(Array.slice(arguments))); };