diff --git a/common/content/commandline.js b/common/content/commandline.js
index 55b1f6fe..6fa48534 100644
--- a/common/content/commandline.js
+++ b/common/content/commandline.js
@@ -2149,265 +2149,4 @@ var ItemList = Class("ItemList", {
})
});
-var OldItemList = Class("ItemList", {
- init: function init(iframe) {
- this._completionElements = [];
-
- this._doc = iframe.contentDocument;
- this._win = iframe.contentWindow;
- this._container = iframe.parentNode;
-
- this._doc.documentElement.id = iframe.id + "-top";
- this._doc.body.id = iframe.id + "-content";
- this._doc.body.className = iframe.className + "-content";
- this._doc.body.appendChild(this._doc.createTextNode(""));
- this._doc.body.style.borderTop = "1px solid black"; // FIXME: For cases where completions/MOW are shown at once, or ls=0. Should use :highlight.
-
- this._items = null;
- this._startIndex = -1; // The index of the first displayed item
- this._endIndex = -1; // The index one *after* the last displayed item
- this._selIndex = -1; // The index of the currently selected element
- this._div = null;
- this._divNodes = {};
- this._minHeight = 0;
- },
-
- _dom: function _dom(xml, map) util.xmlToDom(xml instanceof XML ? xml : <>{xml}>, this._doc, map),
-
- _autoSize: function _autoSize() {
- if (!this._div)
- return;
-
- if (this._container.collapsed)
- this._div.style.minWidth = document.getElementById("dactyl-commandline").scrollWidth + "px";
-
- this._minHeight = Math.max(this._minHeight,
- this._win.scrollY + this._divNodes.completions.getBoundingClientRect().bottom);
-
- if (this._container.collapsed)
- this._div.style.minWidth = "";
-
- // FIXME: Belongs elsewhere.
- mow.resize(false, Math.max(0, this._minHeight - this._container.height));
-
- this._container.height = this._minHeight;
- this._container.height -= mow.spaceNeeded;
- mow.resize(false);
- this.timeout(function () {
- this._container.height -= mow.spaceNeeded;
- });
- },
-
- _getCompletion: function _getCompletion(index) this._completionElements.snapshotItem(index - this._startIndex),
-
- _init: function _init() {
- this._div = this._dom(
-
-
-
{_("completion.noCompletions")}
-
-
-
- {
- template.map(util.range(0, options["maxitems"] * 2), function (i)
-
-
~
- )
- }
-
-
, this._divNodes);
- this._doc.body.replaceChild(this._div, this._doc.body.firstChild);
- DOM(this._divNodes.wrapper).scrollIntoView(true);
-
- this._items.contextList.forEach(function init_eachContext(context) {
- delete context.cache.nodes;
- if (!context.items.length && !context.message && !context.incomplete)
- return;
- context.cache.nodes = [];
- this._dom(
-
- { context.createRow(context.title || [], "CompTitle") }
-
-
-
-
-
-
{ItemList.WAITING_MESSAGE}
-
-
, context.cache.nodes);
- this._divNodes.completions.appendChild(context.cache.nodes.root);
- }, this);
-
- this.timeout(this._autoSize);
- },
-
- /**
- * Uses the entries in "items" to fill the listbox and does incremental
- * filling to speed up things.
- *
- * @param {number} offset Start at this index and show options["maxitems"].
- */
- _fill: function _fill(offset) {
- XML.ignoreWhiteSpace = false;
- let diff = offset - this._startIndex;
- if (this._items == null || offset == null || diff == 0 || offset < 0)
- return false;
-
- this._startIndex = offset;
- this._endIndex = Math.min(this._startIndex + options["maxitems"], this._items.allItems.items.length);
-
- let haveCompletions = false;
- let off = 0;
- let end = this._startIndex + options["maxitems"];
- function getRows(context) {
- function fix(n) Math.constrain(n, 0, len);
- let len = context.items.length;
- let start = off;
- end -= !!context.message + context.incomplete;
- off += len;
-
- let s = fix(offset - start), e = fix(end - start);
- return [s, e, context.incomplete && e >= offset && off - 1 < end];
- }
-
- this._items.contextList.forEach(function fill_eachContext(context) {
- let nodes = context.cache.nodes;
- if (!nodes)
- return;
- haveCompletions = true;
-
- let root = nodes.root;
- let items = nodes.items;
- let [start, end, waiting] = getRows(context);
-
- if (context.message) {
- nodes.message.textContent = "";
- nodes.message.appendChild(this._dom(context.message));
- }
- nodes.message.style.display = context.message ? "block" : "none";
- nodes.waiting.style.display = waiting ? "block" : "none";
- nodes.up.style.opacity = "0";
- nodes.down.style.display = "none";
-
- for (let [i, row] in Iterator(context.getRows(start, end, this._doc)))
- nodes[i] = row;
- for (let [i, row] in array.iterItems(nodes)) {
- if (!row)
- continue;
- let display = (i >= start && i < end);
- if (display && row.parentNode != items) {
- do {
- var next = nodes[++i];
- if (next && next.parentNode != items)
- next = null;
- }
- while (!next && i < end)
- items.insertBefore(row, next);
- }
- else if (!display && row.parentNode == items)
- items.removeChild(row);
- }
- if (context.items.length == 0)
- return;
- nodes.up.style.opacity = (start == 0) ? "0" : "1";
- if (end != context.items.length)
- nodes.down.style.display = "block";
- else
- nodes.up.style.display = "block";
- if (start == end) {
- nodes.up.style.display = "none";
- nodes.down.style.display = "none";
- }
- }, this);
-
- this._divNodes.noCompletions.style.display = haveCompletions ? "none" : "block";
-
- this._completionElements = DOM.XPath("//xhtml:div[@dactyl:highlight='CompItem']", this._doc);
-
- return true;
- },
-
- clear: function clear() { this.setItems(); this._doc.body.innerHTML = ""; },
- get visible() !this._container.collapsed,
- set visible(val) this._container.collapsed = !val,
-
- update: function reset(brief) {
- this._startIndex = this._endIndex = this._selIndex = -1;
- this._div = null;
- if (!brief)
- this.selectItem(-1);
- },
-
- // if @param selectedItem is given, show the list and select that item
- setItems: function setItems(newItems, selectedItem) {
- if (this._selItem > -1)
- this._getCompletion(this._selItem).removeAttribute("selected");
-
- if (this._container.collapsed) {
- this._minHeight = 0;
- this._container.height = 0;
- }
-
- this._startIndex = this._endIndex = this._selIndex = -1;
- this._items = newItems;
- this.update(true);
- if (typeof selectedItem == "number") {
- this.selectItem(selectedItem);
- this.visible = true;
- }
- },
- get open() this.closure.setItems,
-
- selectItem: function selectItem(index) {
- //let now = Date.now();
-
- if (this._div == null)
- this._init();
-
- let sel = this._selIndex;
- let len = this._items.allItems.items.length;
- let newOffset = this._startIndex;
- let maxItems = options["maxitems"];
- let contextLines = Math.min(3, parseInt((maxItems - 1) / 2));
-
- if (index == -1 || index == null || index == len) { // wrapped around
- if (this._selIndex < 0)
- newOffset = 0;
- this._selIndex = -1;
- index = -1;
- }
- else {
- if (index <= this._startIndex + contextLines)
- newOffset = index - contextLines;
- if (index >= this._endIndex - contextLines)
- newOffset = index + contextLines - maxItems + 1;
-
- newOffset = Math.min(newOffset, len - maxItems);
- newOffset = Math.max(newOffset, 0);
-
- this._selIndex = index;
- }
-
- if (sel > -1)
- this._getCompletion(sel).removeAttribute("selected");
- this._fill(newOffset);
- if (index >= 0) {
- this._getCompletion(index).setAttribute("selected", "true");
- if (this._container.height != 0)
- DOM(this._getCompletion(index)).scrollIntoView();
- }
-
- //if (index == 0)
- // this.start = now;
- //if (index == Math.min(len - 1, 100))
- // util.dump({ time: Date.now() - this.start });
- },
-
- onKeyPress: function onKeyPress(event) false
-}, {
- WAITING_MESSAGE: _("completion.generating"),
-});
-
// vim: set fdm=marker sw=4 ts=4 et:
diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm
index dbd1530d..48549f7f 100644
--- a/common/modules/finder.jsm
+++ b/common/modules/finder.jsm
@@ -594,40 +594,6 @@ var RangeFind = Class("RangeFind", {
this.found = false;
},
- // This doesn't work yet.
- resetCaret: function () {
- let equal = RangeFind.equal;
- let selection = this.win.getSelection();
- if (selection.rangeCount == 0)
- selection.addRange(this.pageStart);
- function getLines() {
- let orig = selection.getRangeAt(0);
- function getRanges(forward) {
- selection.removeAllRanges();
- selection.addRange(orig);
- let cur = orig;
- while (true) {
- var last = cur;
- this.sel.lineMove(forward, false);
- cur = selection.getRangeAt(0);
- if (equal(cur, last))
- break;
- yield cur;
- }
- }
- yield orig;
- for (let range in getRanges(true))
- yield range;
- for (let range in getRanges(false))
- yield range;
- }
- for (let range in getLines()) {
- if (this.sel.checkVisibility(range.startContainer, range.startOffset, range.startOffset))
- return range;
- }
- return null;
- },
-
find: function (pattern, reverse, private_) {
if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange))
this.reset();