From 5415cad4e741ff80c25d62af8cca3d8fa3972b8b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 23 Jan 2011 22:09:25 +1100 Subject: [PATCH 1/5] Improve help file formatting for options with long default values. --HG-- extra : rebase_source : 812cf6121ac5fbf7fb7d6871394c093fe65edcad --- common/locale/en-US/options.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index c289a974..70f46cbe 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -328,6 +328,7 @@ 'act' 'activate' 'activate' 'act' + stringlist addons,bookmarks,diverted,downloads,extoptions, help,homepage,quickmark,tabopen,paste @@ -853,6 +854,7 @@ 'ht' 'hinttags' 'hinttags' 'ht' + string &hinttags; @@ -1061,6 +1063,7 @@ 'nextpattern' 'nextpattern' + stringlist '\bnext',^>$,'^(>>|»)$','^(>|»)','(>|»)$','\bmore\b' @@ -1164,6 +1167,7 @@ 'previouspattern' 'previouspattern' + stringlist @@ -1463,6 +1467,7 @@ 'wia' 'wildanchor' 'wildanchor' 'wia' + regexplist !'/ex/(back|buffer|ext|forward|help|undo)' From 05e0dd6f6b1e07d098ab8d31ef0bafd39bbee9cd Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 24 Jan 2011 12:21:22 +1100 Subject: [PATCH 2/5] Add arg validation to :pageinfo. --- common/content/buffer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 21008477..b240820f 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1423,7 +1423,13 @@ var Buffer = Module("buffer", { commands.add(["pa[geinfo]"], "Show various page information", - function (args) { buffer.showPageInfo(true, args[0]); }, + function (args) { + let arg = args[0]; + let opt = options.get("pageinfo"); + + dactyl.assert(opt.validator(opt.parse(arg)), "E475: Invalid argument: " + arg); + buffer.showPageInfo(true, arg); + }, { argCount: "?", completer: function (context) { From 92dbb759bc70d317883590fc93f4f2e6baacf811 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sun, 23 Jan 2011 18:20:11 -0500 Subject: [PATCH 3/5] Fix arbitrary limit on the number of substrings to highlight in template.highlightSubstrings. --HG-- extra : transplant_source : %C4%94%92%C9x%D0%94%25%9A%9C%0B%1B%F5%0C%26%94GT9%09 --- common/modules/template.jsm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 1cd8764a..36847f6d 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -182,10 +182,12 @@ var Template = Module("Template", { str = String(str).replace(" ", "\u00a0"); let s = <>; let start = 0; - let n = 0; + let n = 0, _i; for (let [i, length, args] in iter) { - if (n++ > 50) // Prevent infinite loops. + if (i == _i || i < _i) break; + _i = i; + XML.ignoreWhitespace = false; s += <>{str.substring(start, i)}; s += highlight.apply(this, Array.concat(args || str.substr(i, length))); @@ -227,14 +229,13 @@ var Template = Module("Template", { linkifyHelp: function linkifyHelp(str, help) { let re = util.regexp( ) - (?=[[!,;./\s]|$) + (?P
 [/\s]|^)
+            (?P '[\w-]+' | :(?:[\w-]+|!) | (?:._)?<[\w-]+> )
+            (?=      [[!,;./\s]|$)
         ]]>, "g");
         return this.highlightSubstrings(str, (function () {
-            let res;
-            while ((res = re.exec(str)) && res[2].length)
-                yield [res.index + res[1].length, res[2].length];
+            for (let res in re.iterate(str))
+                yield [res.index + res.pre.length, res.tag.length];
         })(), template[help ? "HelpLink" : "helpLink"]);
     },
 

From 353f2331674382e25d480cdc1397ea4836eb7d4a Mon Sep 17 00:00:00 2001
From: Kris Maglione 
Date: Sun, 23 Jan 2011 20:07:50 -0500
Subject: [PATCH 4/5] Fix error when closing last about:blank tab on FF36.
 Closes issue #299.

--HG--
extra : transplant_source : P%95%87n%EC%F51%BA%92h%12%8EV%1B2%B7%A5%D2%97%A9
---
 common/content/buffer.js      | 7 +------
 pentadactyl/content/config.js | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/content/buffer.js b/common/content/buffer.js
index b240820f..f9e73458 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -425,12 +425,7 @@ var Buffer = Module("buffer", {
     /**
      * @property {string} The current top-level document's URL.
      */
-    get URL() {
-        let str = String(content.location.href);
-        for (let [k, v] in Iterator(util.newURI(content.location.href)))
-            str[k] = v;
-        return str;
-    },
+    get URL() update(content.location.href, util.newURI(content.location.href)),
 
     /**
      * @property {number} The buffer's height in pixels.
diff --git a/pentadactyl/content/config.js b/pentadactyl/content/config.js
index bed5b294..3c98bca7 100644
--- a/pentadactyl/content/config.js
+++ b/pentadactyl/content/config.js
@@ -85,7 +85,7 @@ var Config = Module("config", ConfigBase, {
             if (this.tabbrowser.mTabs.length > 1)
                 this.tabbrowser.removeTab(tab);
             else {
-                if (modules.buffer.URL != "about:blank" || window.getWebNavigation().sessionHistory.count > 0) {
+                if (modules.buffer.uri.spec !== "about:blank" || window.getWebNavigation().sessionHistory.count > 0) {
                     dactyl.open("about:blank", dactyl.NEW_BACKGROUND_TAB);
                     this.tabbrowser.removeTab(tab);
                 }

From 5dc0dfd9533b8cebf07352f20196469550f742d2 Mon Sep 17 00:00:00 2001
From: Kris Maglione 
Date: Sun, 23 Jan 2011 20:34:06 -0500
Subject: [PATCH 5/5] Merge changes from key-processing branch.

---
 common/content/commandline.js   |  4 ++--
 common/content/modes.js         | 20 ++++++++++++--------
 common/locale/en-US/options.xml | 10 +++++-----
 common/modules/base.jsm         |  2 +-
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/common/content/commandline.js b/common/content/commandline.js
index f1ec7d79..a838e4bd 100644
--- a/common/content/commandline.js
+++ b/common/content/commandline.js
@@ -1115,9 +1115,9 @@ var CommandLine = Module("commandline", {
             }
 
             // TODO: Wouldn't multiple handlers be cleaner? --djk
-            if (event.type == "click" && (event.target instanceof HTMLAnchorElement ||
-                                          event.originalTarget.hasAttributeNS(NS, "command"))) {
+            if (event.type == "click" && event.target instanceof HTMLAnchorElement) {
 
+                util.dump(event.getPreventDefault(), event.target);
                 if (event.getPreventDefault())
                     return;
 
diff --git a/common/content/modes.js b/common/content/modes.js
index a32011af..023e9ca5 100644
--- a/common/content/modes.js
+++ b/common/content/modes.js
@@ -60,9 +60,10 @@ var Modes = Module("modes", {
         this.addMode("VISUAL", {
             char: "v",
             description: "Active when text is selected",
+            display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : ""),
             bases: [this.COMMAND],
             ownsFocus: true,
-            display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : "")
+            passUnknown: false
         }, {
             leave: function (stack, newMode) {
                 if (newMode.main == modes.CARET) {
@@ -98,7 +99,8 @@ var Modes = Module("modes", {
             char: "t",
             description: "Vim-like editing of input elements",
             bases: [this.COMMAND],
-            ownsFocus: true
+            ownsFocus: true,
+            passUnknown: false
         });
         this.addMode("OUTPUT_MULTILINE", {
             description: "Active when the multi-line output buffer is open",
@@ -432,11 +434,7 @@ var Modes = Module("modes", {
 
         get bases() this.input ? [modes.INPUT] : [modes.MAIN],
 
-        get toStringParams() [this.name],
-
-        valueOf: function () this.id,
-
-        count: true,
+        get count() !this.input,
 
         get description() this._display,
 
@@ -450,7 +448,13 @@ var Modes = Module("modes", {
 
         input: false,
 
-        get mask() this
+        passUnknown: false,
+
+        get mask() this,
+
+        get toStringParams() [this.name],
+
+        valueOf: function () this.id
     }, {
         _id: 0
     }),
diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml
index 70f46cbe..5016950d 100644
--- a/common/locale/en-US/options.xml
+++ b/common/locale/en-US/options.xml
@@ -327,8 +327,8 @@
 
 
     'act' 'activate'
-    'activate' 'act'
     
+    'activate' 'act'
     stringlist
     addons,bookmarks,diverted,downloads,extoptions,
           help,homepage,quickmark,tabopen,paste
@@ -853,8 +853,8 @@
 
 
     'ht' 'hinttags'
-    'hinttags' 'ht'
     
+    'hinttags' 'ht'
     string
     &hinttags;
     
@@ -1062,8 +1062,8 @@
 
 
     'nextpattern'
-    'nextpattern'
     
+    'nextpattern'
     stringlist
     '\bnext',^>$,'^(>>|»)$','^(>|»)','(>|»)$','\bmore\b'
     
@@ -1166,8 +1166,8 @@
 
 
     'previouspattern'
-    'previouspattern'
     
+    'previouspattern'
     stringlist
     
     
@@ -1466,8 +1466,8 @@
 
 
     'wia' 'wildanchor'
-    'wildanchor' 'wia'
     
+    'wildanchor' 'wia'
     regexplist
     !'/ex/(back|buffer|ext|forward|help|undo)'
     
diff --git a/common/modules/base.jsm b/common/modules/base.jsm
index 071688eb..caaab70b 100644
--- a/common/modules/base.jsm
+++ b/common/modules/base.jsm
@@ -427,7 +427,7 @@ function isinstance(object, interfaces) {
             if (objproto.toString.call(object) === "[object " + interfaces[i] + "]")
                 return true;
         }
-        else if ("isinstance" in object && object.isinstance !== isinstance) {
+        else if (typeof object === "object" && "isinstance" in object && object.isinstance !== isinstance) {
             if (object.isinstance(interfaces[i]))
                 return true;
         }