From a9206c4e3ce3be6327467363e5d66c7d02cc4c72 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 9 Oct 2010 17:03:57 -0400 Subject: [PATCH 1/5] Fix startup in permanent private browsing mode. --- common/modules/sanitizer.jsm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 0c57a174..f262e5ea 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -292,8 +292,12 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR "Set the 'private browsing' option", "boolean", false, { - setter: function (value) services.get("privateBrowsing").privateBrowsingEnabled = value, - getter: function () services.get("privateBrowsing").privateBrowsingEnabled + initialValue: true, + getter: function () services.get("privateBrowsing").privateBrowsingEnabled, + setter: function (value) { + if (services.get("privateBrowsing").privateBrowsingEnabled != value) + services.get("privateBrowsing").privateBrowsingEnabled = value + } }); options.add(["sanitizeitems", "si"], From d0e2262565d883c32c31645399e14da01527dc9e Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 9 Oct 2010 19:47:32 -0400 Subject: [PATCH 2/5] Fix displaying of selected hint, especally with g; --- common/content/bookmarks.js | 5 +++-- common/content/hints.js | 41 +++++++++++++++++++------------------ common/modules/base.jsm | 2 +- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 1195af43..0cb4d0ab 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -58,7 +58,8 @@ const Bookmarks = Module("bookmarks", { if (!id) return false; - PlacesUtils.setPostDataForBookmark(id, post); + if (post !== undefined) + PlacesUtils.setPostDataForBookmark(id, post); if (keyword) services.get("bookmarks").setKeywordForBookmark(id, keyword); } @@ -359,7 +360,7 @@ const Bookmarks = Module("bookmarks", { force: args.bang, starOnly: false, keyword: args["-keyword"] || null, - post: args["-post"] || null, + post: args["-post"], tags: args["-tags"] || [], title: args["-title"] || (args.length === 0 ? buffer.title : null), url: args.length === 0 ? buffer.URL : args[0] diff --git a/common/content/hints.js b/common/content/hints.js index 8cbfbc1c..c9865990 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -334,11 +334,11 @@ const Hints = Module("hints", { * @param {boolean} active Whether it is the currently active hint or not. */ _setClass: function (elem, active) { - let prefix = (elem.getAttributeNS(NS.uri, "class") || "") + " "; + let prefix = (elem.getAttributeNS(NS, "class") || "") + " "; if (active) - elem.setAttributeNS(NS.uri, "highlight", prefix + "HintActive"); + elem.setAttributeNS(NS, "highlight", prefix + "HintActive"); else - elem.setAttributeNS(NS.uri, "highlight", prefix + "HintElem"); + elem.setAttributeNS(NS, "highlight", prefix + "HintElem"); }, /** @@ -363,7 +363,7 @@ const Hints = Module("hints", { hint.imgSpan.style.display = (valid ? "" : "none"); if (!valid) { - hint.elem.removeAttributeNS(NS.uri, "highlight"); + hint.elem.removeAttributeNS(NS, "highlight"); continue inner; } @@ -399,7 +399,7 @@ const Hints = Module("hints", { // FIXME: Broken for imgspans. for (let [, { doc: doc }] in Iterator(this._docs)) { for (let elem in util.evaluateXPath("//*[@dactyl:highlight and @number]", doc)) { - let group = elem.getAttributeNS(NS.uri, "highlight"); + let group = elem.getAttributeNS(NS, "highlight"); css.push(highlight.selector(group) + "[number=" + elem.getAttribute("number").quote() + "] { " + elem.style.cssText + " }"); } } @@ -418,20 +418,11 @@ const Hints = Module("hints", { * hint disappears. */ _removeHints: function (timeout, slight) { - let firstElem = this._validHints[0] || null; - for (let [,{ doc: doc, start: start, end: end }] in Iterator(this._docs)) { for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc)) elem.parentNode.removeChild(elem); - for (let i in util.range(start, end + 1)) { - let hint = this._pageHints[i]; - if (!timeout || hint.elem != firstElem) - hint.elem.removeAttributeNS(NS.uri, "highlight"); - } - - // animate the disappearance of the first hint - if (timeout && firstElem) - this.timeout(function () { firstElem.removeAttributeNS(NS.uri, "highlight"); }, timeout); + for (let i in util.range(start, end + 1)) + this._pageHints[i].elem.removeAttributeNS(NS, "highlight"); } styles.removeSheet(true, "hint-positions"); @@ -479,6 +470,7 @@ const Hints = Module("hints", { let activeIndex = (this._hintNumber ? this._hintNumber - 1 : 0); let elem = this._validHints[activeIndex]; let top = this._top; + if (this._continue) { this.__reset(); if (this._validHints.length <= 1) @@ -486,11 +478,17 @@ const Hints = Module("hints", { } else { this._removeHints(timeout); - if (timeout == 0) - // force a possible mode change, based on whether an input field has focus - events.onFocusChange(); } + let n = 3; + (function next() { + this._setClass(elem, n % 2); + if (n--) + this.timeout(next, 50); + else if (!this._top) + elem.removeAttributeNS(NS, "highlight"); + }).call(this); + this.timeout(function () { if ((modes.extended & modes.HINTS) && !this._continue) modes.pop(); @@ -512,7 +510,9 @@ const Hints = Module("hints", { if (this._hintNumber > 0 && this._hintNumber * this.hintKeys.length <= this._validHints.length) { let timeout = options["hinttimeout"]; if (timeout > 0) - this._activeTimeout = this.timeout(function () { this._processHints(true); }, timeout); + this._activeTimeout = this.timeout(function () { + this._processHints(true); + }, timeout); } else // we have a unique hint this._processHints(true); @@ -903,6 +903,7 @@ const Hints = Module("hints", { dactyl.assert(this._hintNumber != 0); this._checkUnique(); + return; } } diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 09cd9391..9710382b 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -816,7 +816,7 @@ Class.prototype = { */ timeout: function (callback, timeout) { const self = this; - let notify = { notify: function notify(timer) { callback.call(self) } }; + let notify = { notify: function notify(timer) { callback.apply(self) } }; let timer = services.create("timer"); timer.initWithCallback(notify, timeout || 0, timer.TYPE_ONE_SHOT); return timer; From d6e62a728d647fdf73ed09983d1dfe82ead9c658 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 9 Oct 2010 20:15:24 -0400 Subject: [PATCH 3/5] Also update hints on scroll events. --- common/content/hints.js | 9 +++++++-- common/content/javascript.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/content/hints.js b/common/content/hints.js index c9865990..812ff1f7 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -38,6 +38,9 @@ const Hints = Module("hints", { self._showHints(); } }); + let appContent = document.getElementById("appcontent"); + if (appContent) + events.addSessionListener(appContent, "scroll", this._resizeTimer.closure.tell, false); const Mode = Hints.Mode; Mode.defaultValue("tags", function () function () options["hinttags"]); @@ -91,8 +94,10 @@ const Hints = Module("hints", { this._activeTimeout = null; }, __reset: function () { - if (!this._usedTabKey) + if (!this._usedTabKey) { this._hintNumber = 0; + this._updateStatusline(); + } }, /** @@ -480,7 +485,7 @@ const Hints = Module("hints", { this._removeHints(timeout); } - let n = 3; + let n = 5; (function next() { this._setClass(elem, n % 2); if (n--) diff --git a/common/content/javascript.js b/common/content/javascript.js index c0d30380..a29ffadf 100644 --- a/common/content/javascript.js +++ b/common/content/javascript.js @@ -537,7 +537,7 @@ const JavaScript = Module("javascript", { args.push(key + string); let compl = function (context, obj) { - let res = completer.call(self, context, funcName, obj, args); + let res = completer.call(self, context, funcName, obj.obj, args); if (res) context.completions = res; }; From 5e231dd571f86254533b01eb27d91ef5278cfc1c Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 9 Oct 2010 21:05:02 -0400 Subject: [PATCH 4/5] Some smaller hint mode tweaks and fixes. --- common/content/hints.js | 19 +++++++++++-------- common/modules/base.jsm | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/common/content/hints.js b/common/content/hints.js index 812ff1f7..8a17950a 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -96,8 +96,13 @@ const Hints = Module("hints", { __reset: function () { if (!this._usedTabKey) { this._hintNumber = 0; - this._updateStatusline(); } + if (this.__continue && this._validHints.length <= 1) { + this._hintString = ""; + commandline.command = this._hintString; + this._showHints(); + } + this._updateStatusline(); }, /** @@ -424,6 +429,7 @@ const Hints = Module("hints", { */ _removeHints: function (timeout, slight) { for (let [,{ doc: doc, start: start, end: end }] in Iterator(this._docs)) { + util.dump(String(doc), start, end); for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc)) elem.parentNode.removeChild(elem); for (let i in util.range(start, end + 1)) @@ -476,21 +482,18 @@ const Hints = Module("hints", { let elem = this._validHints[activeIndex]; let top = this._top; - if (this._continue) { + if (this._continue) this.__reset(); - if (this._validHints.length <= 1) - this._showHints(); - } - else { + else this._removeHints(timeout); - } let n = 5; (function next() { this._setClass(elem, n % 2); + util.dump(n, String(this._top)); if (n--) this.timeout(next, 50); - else if (!this._top) + else if (!this._validHints.some(function (h) h.elem == elem)) elem.removeAttributeNS(NS, "highlight"); }).call(this); diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 9710382b..4077d9c4 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -816,7 +816,7 @@ Class.prototype = { */ timeout: function (callback, timeout) { const self = this; - let notify = { notify: function notify(timer) { callback.apply(self) } }; + let notify = { notify: function notify(timer) { try { callback.apply(self) } catch (e) { util.reportError(e) } } }; let timer = services.create("timer"); timer.initWithCallback(notify, timeout || 0, timer.TYPE_ONE_SHOT); return timer; From c0729269dd0df67e2188bd5ab4644c73738b92a2 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sun, 10 Oct 2010 02:55:42 -0400 Subject: [PATCH 5/5] Add command argument/option/quoting help information. --- common/locale/en-US/all.xml | 46 ++++++++++----------- common/locale/en-US/cmdline.xml | 69 +++++++++++++++++++++++++++++++- pentadactyl/TODO | 1 - pentadactyl/locale/en-US/all.xml | 2 +- 4 files changed, 92 insertions(+), 26 deletions(-) diff --git a/common/locale/en-US/all.xml b/common/locale/en-US/all.xml index ccb98583..52586868 100644 --- a/common/locale/en-US/all.xml +++ b/common/locale/en-US/all.xml @@ -12,29 +12,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/locale/en-US/cmdline.xml b/common/locale/en-US/cmdline.xml index 1f911d34..825f56b1 100644 --- a/common/locale/en-US/cmdline.xml +++ b/common/locale/en-US/cmdline.xml @@ -152,6 +152,7 @@ +

Ex command lines

@@ -212,7 +213,73 @@

-
+ + +

Ex command-line arguments

+ +

+ Most Ex commands accept a number of options and arguments. Arguments and + options are generally separated by spaces, and treat a number of + characters, including \, ', ", and |, + specially. Moreover, certain arguments have their own special characters. + For instance, when using :set to change a stringlist + option, the comma character is used to separate elements of said list. Or + when calling :autocmd, the pattern given may be negated by + prefixing it with a !. In order to use these characters in + command arguments, stripped of their special meaning, they must be quoted. +

+ +

+ &dactyl.appName; offers four distinct quoting styles, each with its own + distinct advantages and disadvantages. The first, and most basic, is the + automatic quoting applied to the commands listed in :bar. When + any of these commands is invoked, their final argument is always + interpreted literally. No characters have special meaning whatsoever, and + no care need be taken to quote anything. Additionally, the following three + optional quoting characters are available: +

+ +
+
\
+
+ This is the most basic quoting character. When it is encountered + outside of single or double quotes, it forces the next character to be + interpreted literally. So, for instance, \\\, + \'', \aa, and + \␣. +
+
'
+
+ Any character inside single quotes aside from the ' character itself + is interpreted literally. To include a literal single quote, it must + be doubled. So, 'foo\ ''bar\\ baz\' ⇒ foo\ 'bar\\ baz\ +
+
"
+
+ Any character inside of double quotes except for " and + \ is interpreted literally. A literal double quote may be + included by preceding it with a backslash. Any other occurrence of a + backslash starts an escape sequence as in JavaScript strings. Among + the available escape sequences are: +
+
\n
A newline character.
+
\t
A tab character.
+
\0nn
Where each n is a digit between 0 and 7, represents an octal character code.
+
\xdd
Where each d is a digit between 0 and F, represents a hexidecimal character code.
+
\uxxxx
Where each x is a digit between 0 and F, a Unicode character at code-point xxxx.
+
+
+
+ +

+ Many Ex commands accept option arguments in addition to regular arguments. + Option arguments begin with a hyphen (-), and often have a short + form and a long form, such as -name and -n. Most options + accept arguments, which come after the option separated by either a space + or an equal sign. For instance, the following three forms, + -name=foo, -name foo, and + -n foo, are all acceptable and entirely equivalent. +

diff --git a/pentadactyl/TODO b/pentadactyl/TODO index bbf5e43d..8b83f75f 100644 --- a/pentadactyl/TODO +++ b/pentadactyl/TODO @@ -25,7 +25,6 @@ BUGS: (recent Mercurial regressions): FEATURES: -9 Add quoting help tag 8 Document Caret and Visual modes. 8 replace global variables with plugin scoped user options 8 fix local options diff --git a/pentadactyl/locale/en-US/all.xml b/pentadactyl/locale/en-US/all.xml index 32e54296..b0335c24 100644 --- a/pentadactyl/locale/en-US/all.xml +++ b/pentadactyl/locale/en-US/all.xml @@ -7,7 +7,7 @@ xmlns="&xmlns.dactyl;" xmlns:html="&xmlns.html;"> - +