"Dwight McDowell" <[EMAIL PROTECTED]> writes:
> modules/mode-line.js | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
> diff --git a/modules/mode-line.js b/modules/mode-line.js
> index 1917159..0d451dc 100644
> --- a/modules/mode-line.js
> +++ b/modules/mode-line.js
> @@ -144,6 +144,20 @@ current_buffer_name_widget.prototype.update = function
> () {
> this.view.text = this.window.buffers.current.description;
> };
> +function window_size_widget(window){
> + this.name = "window-size-widget";
> + text_widget.call(this, window);
> + this.add_hook("current_content_buffer_location_change_hook");
> + this.add_hook("select_buffer_hook");
I don't think these are the correct hooks to be adding for this widget.
Neither of these events should indicate a change in the window size.
Instead, you probably should add an event listener to the window for the
"resize" event, and remember to remove the handler in the destroy method
(and also call the "superclass" destroy method via
this.__proto__.__proto__.destroy.call(this)).
> +}
> +window_size_widget.prototype.__proto__ = text_widget.prototype;
> +window_size_widget.prototype.update = function() {
> + var topwin = this.window;
> + w = topwin.innerWidth;
> + h = topwin.innerHeight;
> + this.view.text = "[" + w + "x" + h + "]";
> +};
Note that this will show the width and height of the top window itself,
as opposed to the width and height of the area filled by the webpage.
Is that intentional? (If so, what is the reason for wanting the width
and height of the top window?)
> +
> function current_buffer_scroll_position_widget(window) {
> this.name = "current-buffer-scroll-position-widget";
> text_widget.call(this, window);
> @@ -197,8 +211,10 @@ function mode_line_adder(widget_constructor) {
> return function (window) { window.mode_line.add_text_widget(new
> widget_constructor(window)); }
> }
> +add_hook("mode_line_hook", mode_line_adder(window_size_widget));
It is not clear that this widget should be enabled by default. It
probably makes more sense to document it somewhere, e.g. the wiki, but
not make it the default. Anyone who wants it can just add that line
into his own rc file.
> add_hook("mode_line_hook", mode_line_adder(current_buffer_name_widget));
> add_hook("mode_line_hook", mode_line_adder(clock_widget));
> add_hook("mode_line_hook",
> mode_line_adder(current_buffer_scroll_position_widget));
> +
> mode_line_mode(true);
--
Jeremy Maitin-Shepard
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror