allow additions to ListBar while it is detached. see #148.

This commit is contained in:
Christopher Jeffrey 2015-07-16 01:03:11 -07:00
parent 89f54e3be4
commit b53835c147
1 changed files with 11 additions and 6 deletions

View File

@ -298,6 +298,17 @@ Listbar.prototype.select = function(offset) {
offset = this.items.indexOf(offset);
}
if (offset < 0) {
offset = 0;
} else if (offset >= this.items.length) {
offset = this.items.length - 1;
}
if (!this.parent) {
this.emit('select item', el, offset);
return;
}
var lpos = this._getCoords();
if (!lpos) return;
@ -307,12 +318,6 @@ Listbar.prototype.select = function(offset) {
, visible = 0
, el;
if (offset < 0) {
offset = 0;
} else if (offset >= this.items.length) {
offset = this.items.length - 1;
}
el = this.items[offset];
if (!el) return;