diff --git a/common/content/buffer.js b/common/content/buffer.js index f6c8eb75..d8322160 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -275,7 +275,7 @@ var Buffer = Module("buffer", { */ get localStore() { let doc = content.document; - let store = overlay.getData(doc, "buffer"); + let store = overlay.getData(doc, "buffer", null); if (!store || !buffer.localStorePrototype.isPrototypeOf(store)) store = overlay.setData(doc, "buffer", Object.create(buffer.localStorePrototype)); return store.instance = store; diff --git a/common/content/commandline.js b/common/content/commandline.js index 61d9fbd5..17542af2 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -153,6 +153,8 @@ var CommandWidgets = Class("CommandWidgets", { } }); this.updateVisibility(); + + this.initialized = true; }, addElement: function addElement(obj) { const self = this; @@ -250,6 +252,9 @@ var CommandWidgets = Class("CommandWidgets", { Array.forEach(node.children, check); } [this.commandbar.container, this.statusbar.container].forEach(check); + + if (this.initialized && loaded.mow && mow.visible) + mow.resize(false); }, active: Class.Memoize(Object), diff --git a/common/content/mow.js b/common/content/mow.js index 9f17fa23..7bf40a9f 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -103,12 +103,15 @@ var MOW = Module("mow", { if (modes.main != modes.OUTPUT_MULTILINE) { modes.push(modes.OUTPUT_MULTILINE, null, { onKeyPress: this.closure.onKeyPress, + leave: this.closure(function leave(stack) { if (stack.pop) for (let message in values(this.messages)) if (message.leave) message.leave(stack); - }) + }), + + window: this.window }); this.messages = []; } @@ -241,12 +244,14 @@ var MOW = Module("mow", { let doc = this.widget.contentDocument; - let availableHeight = config.outputHeight; + let trim = Math.max(0, DOM("#" + config.ids.commandContainer, document).rect.bottom - window.innerHeight); + let availableHeight = config.outputHeight - trim; if (this.visible) availableHeight += parseFloat(this.widgets.mowContainer.height || 0); availableHeight -= extra || 0; doc.body.style.minWidth = this.widgets.commandbar.commandline.scrollWidth + "px"; + this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px"; this.timeout(function () this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px", diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm index 782df595..d5922096 100644 --- a/common/modules/finder.jsm +++ b/common/modules/finder.jsm @@ -10,6 +10,8 @@ defineModule("finder", { require: ["prefs"] }, this); +this.lazyRequire("overlay", ["overlay"]); + function equals(a, b) XPCNativeWrapper(a) == XPCNativeWrapper(b); /** @instance rangefinder */ @@ -22,13 +24,21 @@ var RangeFinder = Module("rangefinder", { this.lastFindPattern = ""; }, + get content() { + let { window } = this.modes.getStack(0).params; + return window || this.window.content; + }, + get rangeFind() { - let find = modules.buffer.localStore.rangeFind; - if (find && find.stale || !isinstance(find, RangeFind)) + let find = overlay.getData(this.content.document, + "range-find", null); + + if (!isinstance(find, RangeFind) || find.stale) return this.rangeFind = null; return find; }, - set rangeFind(val) modules.buffer.localStore.rangeFind = val + set rangeFind(val) overlay.setData(this.content.document, + "range-find", val) }), init: function init() { @@ -44,7 +54,7 @@ var RangeFinder = Module("rangefinder", { openPrompt: function (mode) { this.modules.marks.push(); this.commandline; - this.CommandMode(mode).open(); + this.CommandMode(mode, this.content).open(); if (this.rangeFind && equals(this.rangeFind.window.get(), this.window)) this.rangeFind.reset(); @@ -95,7 +105,7 @@ var RangeFinder = Module("rangefinder", { if (this.rangeFind) this.rangeFind.cancel(); - this.rangeFind = RangeFind(this.window, matchCase, backward, + this.rangeFind = RangeFind(this.window, this.content, matchCase, backward, linksOnly && this.options.get("hinttags").matcher, regexp); this.rangeFind.highlighted = highlighted; @@ -211,8 +221,9 @@ var RangeFinder = Module("rangefinder", { commandline: function initCommandline(dactyl, modules, window) { const { rangefinder } = modules; rangefinder.CommandMode = Class("CommandFindMode", modules.CommandMode, { - init: function init(mode) { + init: function init(mode, window) { this.mode = mode; + this.window = window; init.supercall(this); }, @@ -327,9 +338,9 @@ var RangeFinder = Module("rangefinder", { * large amounts of data are concerned (e.g., for API documents). */ var RangeFind = Class("RangeFind", { - init: function init(window, matchCase, backward, elementPath, regexp) { + init: function init(window, content, matchCase, backward, elementPath, regexp) { this.window = Cu.getWeakReference(window); - this.content = window.content; + this.content = content; this.baseDocument = Cu.getWeakReference(this.content.document); this.elementPath = elementPath || null; @@ -346,7 +357,7 @@ var RangeFind = Class("RangeFind", { this.lastString = ""; }, - get store() this.content.document.dactylStore = this.content.document.dactylStore || {}, + get store() overlay.getData(this.content.document, "buffer", Object), get backward() this.finder.findBackwards, set backward(val) this.finder.findBackwards = val, @@ -682,7 +693,7 @@ var RangeFind = Class("RangeFind", { } var range = this.finder.Find(word, this.range.range, start, this.range.range); - if (range) + if (range && DOM(range.commonAncestorContainer).isVisible) break; } diff --git a/pentadactyl/TODO b/pentadactyl/TODO index 67d4b748..a049b671 100644 --- a/pentadactyl/TODO +++ b/pentadactyl/TODO @@ -20,7 +20,6 @@ FEATURES: 9 add [count] support to :b* and :tab* commands where missing 8 wherever possible: get rid of dialogs and ask console-like dialog questions or write error prompts directly on the webpage or with :echo() -8 add search capability to MOW 8 registers 8 Document Caret and Visual modes. 8 add support for filename special characters such as %