mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-02-01 21:57:17 +00:00
allow appending of listbar items while detached. fixes #148.
This commit is contained in:
parent
67b6674558
commit
72ddc05fd1
@ -157,13 +157,18 @@ Listbar.prototype.addItem =
|
||||
Listbar.prototype.appendItem = function(item, callback) {
|
||||
var self = this
|
||||
, prev = this.items[this.items.length - 1]
|
||||
, drawn = prev ? prev.aleft + prev.width : 0
|
||||
, drawn
|
||||
, cmd
|
||||
, title
|
||||
, len;
|
||||
|
||||
if (!this.screen.autoPadding) {
|
||||
drawn += this.ileft;
|
||||
if (!this.parent) {
|
||||
drawn = 0;
|
||||
} else {
|
||||
drawn = prev ? prev.aleft + prev.width : 0
|
||||
if (!this.screen.autoPadding) {
|
||||
drawn += this.ileft;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof item === 'object') {
|
||||
|
@ -18,7 +18,7 @@ var box = blessed.box({
|
||||
});
|
||||
|
||||
var bar = blessed.listbar({
|
||||
parent: screen,
|
||||
//parent: screen,
|
||||
bottom: 0,
|
||||
left: 3,
|
||||
right: 3,
|
||||
@ -110,6 +110,8 @@ var bar = blessed.listbar({
|
||||
}
|
||||
});
|
||||
|
||||
screen.append(bar);
|
||||
|
||||
bar.focus();
|
||||
|
||||
screen.key('q', function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user