During a hints interaction, conkeror can display the URL and other
information about the currently selected hint.  The information is now
displayed, using an annotated-textbox, in the minibuffer to the right
of the input text.

This display replaces the previous URL panel feature; the content is
unchanged.  Users should replace use of hints_display_url_panel=true
with hints_information=true.  The new display is more attractive and
it avoids obscuring part of the content buffer, fixing
http://bugs.conkeror.org/issue343.
---
 contrib/config/common.js           |    2 +-
 modules/hints.js                   |   63 +++++++++++++++++-------------------
 style/default/hints--url-panel.css |   11 ------
 style/default/minibuffer.css       |    3 ++
 style/default/panel.css            |    6 +++
 style/default/theme.json           |    2 +-
 6 files changed, 41 insertions(+), 46 deletions(-)
 delete mode 100644 style/default/hints--url-panel.css
 create mode 100644 style/default/panel.css

diff --git a/contrib/config/common.js b/contrib/config/common.js
index d993293..ab5ee4b 100644
--- a/contrib/config/common.js
+++ b/contrib/config/common.js
@@ -20,7 +20,7 @@ hints_ambiguous_auto_exit_delay = 500;
 
 // display properties of the current selected node during
 // the hints interaction.
-hints_display_url_panel = true;
+hints_information = true;
 
 
 // default directory for downloads and shell commands.
diff --git a/modules/hints.js b/modules/hints.js
index e8b30ed..989f94f 100644
--- a/modules/hints.js
+++ b/modules/hints.js
@@ -419,21 +419,20 @@ hint_manager.prototype = {
 };
 
 /**
- * Show panel with currently selected URL.
+ * Display the URL and other information for the currently selected node.
  */
-function hints_url_panel (hints, window) {
-    var g = new dom_generator(window.document, XUL_NS);
-
-    var p = g.element("hbox", "class", "panel url", "flex", "0");
-    g.element("label", p, "value", "URL:", "class", "url-panel-label");
-    var url_value = g.element("label", p, "class", "url-panel-value",
-                              "crop", "end", "flex", "1");
-    window.minibuffer.insert_before(p);
+function hints_info (hints, window) {
+    this.hints = hints;
+    this.input = window.minibuffer.input_element;
+    this.input.annotate = true;
+}
+hints_info.prototype = {
+    constructor: hints_info,
 
-    p.update = function () {
+    update: function () {
        var s = [];
-       if (hints.manager && hints.manager.last_selected_hint) {
-            var elem = hints.manager.last_selected_hint.elem;
+       if (this.hints.manager && this.hints.manager.last_selected_hint) {
+            var elem = this.hints.manager.last_selected_hint.elem;
             if (elem.hasAttribute("onmousedown") ||
                 elem.hasAttribute("onclick"))
             {
@@ -454,21 +453,19 @@ function hints_url_panel (hints, window) {
                 } catch (e) {}
             }
        }
-        url_value.value = s.join(" ");
-    };
-
-    p.destroy = function () {
-        this.parentNode.removeChild(this);
-    };
+        this.input.annotation = s.join(" ");
+    },
 
-    return p;
-}
+    destroy: function () {
+        this.input.annotate = false;
+    }
+};
 
-define_variable("hints_display_url_panel", false,
-    "When selecting a hint, the URL can be displayed in a panel above "+
-    "the minibuffer.  This is useful for confirming that the correct "+
-    "link is selected and that the URL is not evil.  This option is "+
-    "most useful when hints_auto_exit_delay is long or disabled.");
+define_variable("hints_information", false,
+    "When selecting a hint, the URL and other information can be "+
+    "displayed in the minibuffer.  This is useful for confirming that "+
+    "the correct link is selected and that the URL is not evil.  This "+
+    "option is most useful when hints_auto_exit_delay is long or disabled.");
 
 /**
  * keyword arguments:
@@ -482,8 +479,8 @@ function hints_minibuffer_state (minibuffer, continuation, 
buffer) {
     keywords(arguments, $keymap = hint_keymap, $auto);
     basic_minibuffer_state.call(this, minibuffer, $prompt = arguments.$prompt,
                                 $keymap = arguments.$keymap);
-    if (hints_display_url_panel)
-       this.url_panel = hints_url_panel(this, buffer.window);
+    if (hints_information)
+       this.hints_info = new hints_info(this, buffer.window);
     this.original_prompt = arguments.$prompt;
     this.continuation = continuation;
     this.auto_exit = arguments.$auto ? true : false;
@@ -507,8 +504,8 @@ hints_minibuffer_state.prototype = {
                                             this.focused_frame, 
this.focused_element);
         }
         this.manager.update_valid_hints();
-        if (this.url_panel)
-            this.url_panel.update();
+        if (this.hints_info)
+            this.hints_info.update();
     },
     clear_auto_exit_timer: function () {
         var window = this.minibuffer.window;
@@ -525,8 +522,8 @@ hints_minibuffer_state.prototype = {
     destroy: function () {
         this.clear_auto_exit_timer();
         this.manager.remove();
-        if (this.url_panel)
-            this.url_panel.destroy();
+        if (this.hints_info)
+            this.hints_info.destroy();
         basic_minibuffer_state.prototype.destroy.call(this);
     },
     update_minibuffer: function (m) {
@@ -534,8 +531,8 @@ hints_minibuffer_state.prototype = {
             m.prompt = this.original_prompt + " #" + this.typed_number;
         else
             m.prompt = this.original_prompt;
-        if (this.url_panel)
-            this.url_panel.update();
+        if (this.hints_info)
+            this.hints_info.update();
     },
 
     handle_auto_exit: function (ambiguous) {
diff --git a/style/default/hints--url-panel.css 
b/style/default/hints--url-panel.css
deleted file mode 100644
index 8a41a11..0000000
--- a/style/default/hints--url-panel.css
+++ /dev/null
@@ -1,11 +0,0 @@
-
-@namespace 
url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";);
-
-.panel .panel-row-label {
-  font-weight: bold;
-}
-
-.panel .url-panel-label {
-  font-weight: bold;
-}
-
diff --git a/style/default/minibuffer.css b/style/default/minibuffer.css
index 253559e..a3b2f25 100644
--- a/style/default/minibuffer.css
+++ b/style/default/minibuffer.css
@@ -10,6 +10,9 @@
   background-color: -moz-field !important;
 }
 
+#minibuffer-input .textbox-input-box {
+  width: 5em;
+}
 
 /* mode text widgets */
 
diff --git a/style/default/panel.css b/style/default/panel.css
new file mode 100644
index 0000000..f55d682
--- /dev/null
+++ b/style/default/panel.css
@@ -0,0 +1,6 @@
+
+@namespace 
url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";);
+
+.panel .panel-row-label {
+  font-weight: bold;
+}
diff --git a/style/default/theme.json b/style/default/theme.json
index 28682cb..1145447 100644
--- a/style/default/theme.json
+++ b/style/default/theme.json
@@ -5,7 +5,7 @@
       "mode-line.css",
       "tab-bar.css",
       "new-tabs.css",
-      "hints--url-panel.css",
+      "panel.css",
       "eye-guide.css"
   ]
 }
-- 
1.7.9

_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to