mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-11 03:25:45 +00:00
add item to ritems on appendItem.
This commit is contained in:
parent
eae9fb5fbd
commit
03e4d0d52b
@ -4149,6 +4149,8 @@ List.prototype.addItem =
|
||||
List.prototype.appendItem = function(item) {
|
||||
var self = this;
|
||||
|
||||
this.ritems.push(item);
|
||||
|
||||
// Note: Could potentially use Button here.
|
||||
var options = {
|
||||
screen: this.screen,
|
||||
@ -4224,8 +4226,6 @@ List.prototype.setItems = function(items) {
|
||||
//, selected = this.selected
|
||||
, sel = this.ritems[this.selected];
|
||||
|
||||
this.ritems = items;
|
||||
|
||||
this.select(0);
|
||||
|
||||
for (; i < items.length; i++) {
|
||||
@ -4240,6 +4240,8 @@ List.prototype.setItems = function(items) {
|
||||
this.remove(original[i]);
|
||||
}
|
||||
|
||||
this.ritems = items;
|
||||
|
||||
// Try to find our old item if it still exists.
|
||||
sel = items.indexOf(sel);
|
||||
if (~sel) this.select(sel);
|
||||
|
Loading…
x
Reference in New Issue
Block a user