diff --git a/common/content/commandline.js b/common/content/commandline.js index 31efa8d2..195a4970 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -305,14 +305,6 @@ var CommandMode = Class("CommandMode", { if (this.complete) this.completions = CommandLine.Completions(commandline.widgets.active.command.inputField, this); - - this.autocompleteTimer = Timer(200, 500, function autocompleteTell(tabPressed) { - if (!events.feedingKeys && this.completions && options["autocomplete"].length) { - this.completions.complete(true, false); - if (this.completions) - this.completions.itemList.visible = true; - } - }, this); }, open: function (command) { @@ -335,17 +327,14 @@ var CommandMode = Class("CommandMode", { commandline.commandSession = this; if (this.command || stack.pop && commandline.command) { this.onChange(commandline.command); - this.autocompleteTimer.flush(true); + if (this.completions) + this.completions.autocompleteTimer.flush(true); } }, leave: function (stack) { - this.autocompleteTimer.reset(); - - if (this.completions) { - this.completions.previewClear(); - this.completions.tabTimer.reset(); - } + if (this.completions) + this.completions.cleanup(); if (this.history) this.history.save(); @@ -368,9 +357,9 @@ var CommandMode = Class("CommandMode", { if (this.completions) { this.resetCompletions(); - this.autocompleteTimer.tell(false); + this.completions.autocompleteTimer.tell(false); if (!this.completions.itemList.visible) - this.autocompleteTimer.flush(); + this.completions.autocompleteTimer.flush(); } this.onChange(commandline.command); }, @@ -614,8 +603,10 @@ var CommandLine = Module("commandline", { if (this.widgets.message && this.widgets.message[1] === this._lastClearable) this.widgets.message = null; - if (!this.commandSession) + if (!this.commandSession) { this.widgets.command = null; + this.hideCompletions(); + } if (modes.main == modes.OUTPUT_MULTILINE && !mow.isScrollable(1)) modes.pop(); @@ -990,11 +981,24 @@ var CommandLine = Module("commandline", { this.itemList = commandline.completionList; this.itemList.setItems(this.context); + this.autocompleteTimer = Timer(200, 500, function autocompleteTell(tabPressed) { + if (!events.feedingKeys && this.completions && options["autocomplete"].length) { + this.complete(true, false); + this.itemList.visible = true; + } + }, this); this.tabTimer = Timer(0, 0, function tabTell(event) { this.tab(event.shiftKey, event.altKey && options["altwildmode"]); }, this); }, + cleanup: function () { + this.previewClear(); + this.tabTimer.reset(); + this.autocompleteTimer.reset(); + this.itemList.visible = false; + }, + UP: {}, DOWN: {}, PAGE_UP: {}, @@ -1207,7 +1211,7 @@ var CommandLine = Module("commandline", { tabs: [], tab: function tab(reverse, wildmode) { - this.session.autocompleteTimer.flush(); + this.autocompleteTimer.flush(); if (this._caret != this.caret) this.reset(); diff --git a/common/content/dactyl.js b/common/content/dactyl.js index bb5aa362..c53cb34b 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -560,9 +560,14 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * @private */ initDocument: function initDocument(doc) { - if (doc.location.protocol === "dactyl:") { - dactyl.initHelp(); - config.styleHelp(); + try { + if (doc.location.protocol === "dactyl:") { + dactyl.initHelp(); + config.styleHelp(); + } + } + catch (e) { + util.reportError(e); } }, @@ -662,9 +667,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { let re = util.regexp( \s*) - (?P [-*+]) \x20 + (?P [-*+]) \ // (?P .*\n - (?: \1\x20\x20.*\n | \s*\n)* ) + (?: \1\ \ .*\n | \s*\n)* ) | (?P (?: ^ [^\S\n]* @@ -676,30 +681,55 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { (?: ^ [^\S\n]* \n) + ]]>, "gmy"); + let betas = util.regexp(/\[(b\d)\]/, "g"); + + let beta = array(betas.iterate(NEWS)) + .map(function (m) m[1]).uniq().slice(-1)[0]; + default xml namespace = NS; - function rec(text, level) { + function rec(text, level, li) { let res = <>; - let list, space; + let list, space, i = 0; for (let match in re.iterate(text)) { if (match.char) { if (!list) res += list =
    ; - list.* +=
  • {rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1)}
  • ; + let li =
  • ; + li.* += rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1, li) + list.* += li; } else if (match.par) { + let [, par, tags] = /([^]*?)\s*((?:\[[^\]]+\])*)\n*$/.exec(match.par); + let t = tags; + tags = array(betas.iterate(tags)).map(function (m) m[1]); + + let group = tags.length && !tags.some(function (t) t == beta) ? "HelpNewsOld" : ""; + if (i === 0 && li) { + li.@highlight = group; + group = ""; + } + list = null; - if (level == 0 && /^.*:\n$/.test(match.par)) - res +=

    {template.linkifyHelp(match.par.slice(0, -1), true)}

    ; + if (level == 0 && /^.*:\n$/.test()) + var elem =

    {template.linkifyHelp(par.slice(0, -1), true)}

    ; else { - let [, a, b] = /^(IMPORTANT:?)?([^]*)/.exec(match.par); - res +=

    { + let [, a, b] = /^(IMPORTANT:?)?([^]*)/.exec(par); + res +=

    { + !tags.length ? "" : + {tags.join(" ")} + }{ a ? {a} : "" }{ template.linkifyHelp(b, true) }

    ; } } + i++; + } + for each (let attr in res..@highlight) { + attr.parent().@NS::highlight = attr; + delete attr.parent().@highlight; } return res; } @@ -710,7 +740,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { '\n' + '\n' + unescape(encodeURI( // UTF-8 handling hack. -

    {config.appName} Versions

    diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 0e818d3f..f5c3d7df 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -613,6 +613,9 @@ var ConfigBase = Class("ConfigBase", { HelpString[delim]::before content: attr(delim); HelpString[delim]::after content: attr(delim); + HelpNews position: relative; + HelpNewsOld opacity: .7; + HelpNewsTag position: absolute; left: 100%; padding-left: 1em; color: #527BBD; opacity: .6; HelpHead;html|h1,html|h2,html|h3,html|h4;dactyl://help/* { font-weight: bold; diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 1c145f1c..962f6458 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -1270,8 +1270,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (tokens) expr = String.replace(expr, /(\(?P)?<(\w+)>/g, function (m, n1, n2) !n1 && set.has(tokens, n2) ? tokens[n2].dactylSource || tokens[n2].source || tokens[n2] : m); - expr = String.replace(expr, /\/\/[^\n]*|\/\*[^]*?\*\//gm, "") - .replace(/\s+/g, ""); + expr = String.replace(expr, /(\\.)|\/\/[^\n]*|\/\*[^]*?\*\/|\s+/gm, function (m, m1) m1 || ""); if (/\(\?P. See :h 'editor'. + editing input fields with i_. See :h 'editor'. [b4] + * Mapping changes: + - It's now possible to map keys in many more modes, including + Hint, Multi-line Output, and Menu. [b4] + - Added site-specific mapping groups and related command + changes. [b6] + - Added l and s to aid in the construction of + macros. [b6] + - Removed the implicit page load delays during macro playback. [b6] + - Added the base modes Base, Main, and Command which other + modes inherit key bindings from. [b6] * Command changes: - :viusage, :optionusage and :exusage were replaced with :listkeys, :listoptions and :listcommands, providing more powerful and consistent interactive help facility (improvements include listing keys for modes other than Normal, filtering the output - and linking to source code locations). + and linking to source code locations). [b4] - :downloads now opens a download list in the multi-line output buffer. - Added :mapgroup command and -group flag to :map, :unmap, and - :mapclear. + :mapclear. [b6] - :extensions has been replaced with a more powerful :addons. - - Added :cookies command. + - Added :cookies command. [b3] - :extadd now supports remote URLs as well as local files on Firefox 4. - - Added :if/:elseif/:else/:endif conditionals. + - Added :if/:elseif/:else/:endif conditionals. [b3] - Added -charset and -post to :bmark. - - Added -keyword, -tags, -title to :delbmarks. + - Added -keyword, -tags, -title to :delbmarks. [b2] - Added :extrehash, :exttoggle, :extupdate, and :rehash commands. - - Added :feedkeys command. - - Added -sort option to :history. + - Added :feedkeys command. [b4] + - Added -sort option to :history. [b4] - Added several new options, including -javascript, to :abbreviate and - :map. - - Added :mksyntax command to auto-generate Vim syntax files. + :map. [b2] + - Added :mksyntax command to auto-generate Vim syntax files. [b4] - :open now only opens files beginning with /, ./, ../, or ~/ - :saveas now provides completions for default file names, and automatically chooses a filename when the save target is a - directory. + directory. [b4] - :sidebar now accepts a ! flag to toggle the sidebar rather than open it unconditionally. - Added :write !cmd and :write >>file. @@ -93,80 +102,73 @@ - :command now accepts comma-separated alternative command names. - :command -complete custom now also accepts a completions array, see :h :command-completion-custom. - * Mapping changes: - - Added site-specific mapping groups and related command - changes. - - Added named aliases for many mappings - - Added l and s to aid in the construction of macros. - - Removed the implicit page load delays during macro playback. - - Added the base modes Base, Main, and Command which other - modes inherit key bindings from. * Improvements to :style and :highlight: - - Added -agent flag to :style. + - Added -link flag to :highlight. [b4] + - Added -agent flag to :style. [b2] - The -append flag now updates existing properties rather than - simply appending its arguments to the previous value. - - Active filters are now highlighted in :style listings. + simply appending its arguments to the previous value. [b4] + - Active filters are now highlighted in :style listings. [b4] - :style-related commands now divide their completions between - those active and inactive for the current site. - - CSS property name completion is now available. + those active and inactive for the current site. [b4] + - CSS property name completion is now available. [b4] * IMPORTANT option changes: - - Boolean options no longer accept an argument. + - Boolean options no longer accept an argument. [b4] - 'cdpath' and 'runtimepath' no longer treat ",," specially. Use "." instead. - 'incsearch', 'hlsearch', 'ignorecase', and 'smartcase' have - been replaced with 'incfind', 'hlfind', and 'findcase'. + been replaced with 'incfind', 'hlfind', and 'findcase'. [b4] - 'extendedhinttags' is now a regexpmap rather than a - string. + string. [b2] - 'guioptions' default value has changed. - 'laststatus' has been replaced with the "s" flag in - 'guioptions'. + 'guioptions'. [b4] - 'linksearch' has been removed. The \l search modifier can - still be used for this purpose. + still be used for this purpose. [b4] - 'loadplugins' is now a regexplist option rather than - a boolean. + a boolean. [b2] - 'mapleader' is now an option rather than a :let variable. - - 'showstatuslinks' and 'showtabline' are now string options. + - 'showstatuslinks' and 'showtabline' are now string options. [b4] * IMPORTANT: Command script files now use the *.penta file extension. * IMPORTANT: Plugins are now loaded from the 'plugins/' directory in 'runtimepath' rather than 'plugin/'. - * IMPORTANT: Option value quoting has changed. List options will - no longer be split at quoted commas and the option name, - operators, and = sign may no longer be quoted. This will break - certain automatically-generated configuration files. - See :help stringlist. * Option changes: + - IMPORTANT: Option value quoting has changed. List options will + no longer be split at quoted commas and the option name, + operators, and = sign may no longer be quoted. This will break + certain automatically-generated configuration files. + See :help stringlist. [b2] - Added "bookmarks", "diverted", and "links" to 'activate' option. - - Added 'altwildmode' and c_ command-line key binding. + - Added 'altwildmode' and c_ command-line key binding. [b2] - Added 'autocomplete' option for specifying which completion - groups should be auto-completed. - - Added 'banghist' option. - - Replaced 'focuscontent' with 'strictfocus'. + groups should be auto-completed. [b2] + - Added 'banghist' option. [b1] + - Replaced 'focuscontent' with 'strictfocus'. [b1] - 'complete' now defaults to "slf" but file completion only triggers when the URL begins as above. - Added 'passkeys' option. - Changed 'urlseparator' default value to "|". - - Added "passwords" and "venkman" dialogs to :dialog. - - Added 'wildanchor' option. - - Added 'cookies', 'cookieaccept', and 'cookielifetime' options. - * Added BookmarkChange, BookmarkRemove autocommands. + - Added "passwords" and "venkman" dialogs to :dialog. [b2] + - Added 'wildanchor' option. [b2] + - Added 'cookies', 'cookieaccept', and 'cookielifetime' options. [b3] + * Added BookmarkChange, BookmarkRemove autocommands. [b2] * Removed the :source line at the end of files generated by - :mkpentadactylrc. + :mkpentadactylrc. [b2] * gf now toggles between source and content view. - The | key binding has been removed. + The | key binding has been removed. [b1] * Page zoom information is now shown in the status bar, and - change in zoom status no longer appears in :messages. - * Added ZO, ZI, ZM, and ZR as aliases for zO, zI, zM, and zR. + change in zoom status no longer appears in :messages. [b1] + * Added ZO, ZI, ZM, and ZR as aliases for zO, zI, zM, and zR. [b1] * Completion list now behaves better when the multi-line output - window is displayed. + window is displayed. [b1] * Major help system improvements: - Plugins may now provide full-fledged :help documentation. - - Add basic plugin authorship documentation. + - Add basic plugin authorship documentation. [b1] - The help system is newly modularized and features significant - updates, rewrites, and formatting improvements. - - Added to open the single unchunked help page. - * Removed :beep. - * Removed :edit, :tabedit, and :winedit aliases. - * Removed :play. + updates, rewrites, and formatting improvements. [b1] + - Added to open the single unchunked help page. [b5] + * Removed :beep. [b2] + * Removed :edit, :tabedit, and :winedit aliases. [b2] + * Removed :play. [b2]