During a hints interaction, conkeror can display the URL and other information about the currently selected hint. The information is now displayed in the minibuffer to the right of the input text and the text is styled differently (in an oblique font) to the input text, so that they can be distinguished.
The input text has a fixed width, with the remaining available space given to the information display. A subsequent patch will allow the input text width to grow as needed for a long input. 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. --- content/minibuffer.css | 1 + content/minibuffer.xul | 1 + contrib/config/common.js | 2 +- modules/hints.js | 66 ++++++++++++++++++----------------- style/default/hints--url-panel.css | 11 ------ style/default/minibuffer.css | 7 ++++ style/default/panel.css | 6 +++ style/default/theme.json | 2 +- 8 files changed, 51 insertions(+), 45 deletions(-) delete mode 100644 style/default/hints--url-panel.css create mode 100644 style/default/panel.css diff --git a/content/minibuffer.css b/content/minibuffer.css index 17ee1b2..2e52eb7 100644 --- a/content/minibuffer.css +++ b/content/minibuffer.css @@ -9,6 +9,7 @@ #minibuffer[minibuffermode="message"] #minibuffer-prompt, #minibuffer[minibuffermode="message"] #minibuffer-input, +#minibuffer[minibuffermode="message"] #minibuffer-info, #minibuffer[minibuffermode="input"] #minibuffer-message, #minibuffer[minibuffermode="input"] #minibuffer-mode-indicator { visibility: collapse; diff --git a/content/minibuffer.xul b/content/minibuffer.xul index 34fc442..6d0d06a 100644 --- a/content/minibuffer.xul +++ b/content/minibuffer.xul @@ -16,6 +16,7 @@ COPYING file. <label class="minibuffer" id="minibuffer-message" flex="1" crop="right" value=""/> <label class="minibuffer" id="minibuffer-prompt" crop="left" value=""/> <textbox class="plain" id="minibuffer-input" flex="1"/> + <label class="plain" id="minibuffer-info" flex="1" crop="right" collapsed="true"/> </hbox> </window> </overlay> 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..28e9011 100644 --- a/modules/hints.js +++ b/modules/hints.js @@ -419,21 +419,23 @@ 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); +function hints_info (hints, window) { + this.hints = hints; + this.input = window.minibuffer.input_element; + this.info = window.document.getElementById("minibuffer-info"); - 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); + this.input.setAttribute("flex", "0"); + this.info.setAttribute("collapsed", "false"); +} +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 +456,21 @@ function hints_url_panel (hints, window) { } catch (e) {} } } - url_value.value = s.join(" "); - }; - - p.destroy = function () { - this.parentNode.removeChild(this); - }; + this.info.value = s.join(" "); + }, - return p; -} + destroy: function () { + this.input.setAttribute("flex", "1"); + this.info.setAttribute("collapsed", "true"); + this.info.value = ""; + } +}; -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 +484,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 +509,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 +527,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 +536,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..3a32c20 100644 --- a/style/default/minibuffer.css +++ b/style/default/minibuffer.css @@ -8,8 +8,15 @@ #minibuffer-input { background-color: -moz-field !important; + width: 5em; } +#minibuffer-info { + background-color: -moz-field !important; + font-style: oblique; + margin: 0px !important; + padding-left: 1em !important; +} /* 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.7.3 _______________________________________________ Conkeror mailing list [email protected] https://www.mozdev.org/mailman/listinfo/conkeror
