mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-11 11:34:20 +00:00
list resizing.
This commit is contained in:
parent
b597bdd1c1
commit
b0b949b301
@ -1498,6 +1498,21 @@ function List(options) {
|
|||||||
// self.emit('select', self.items[self.selected], self.selected);
|
// self.emit('select', self.items[self.selected], self.selected);
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
function resize() {
|
||||||
|
var visible = self.height - (self.border ? 2 : 0);
|
||||||
|
if (visible >= self.selected + 1) {
|
||||||
|
//if (self.selected < visible - 1) {
|
||||||
|
self.childBase = 0;
|
||||||
|
self.childOffset = self.selected;
|
||||||
|
} else {
|
||||||
|
self.childBase = self.selected - visible + 1;
|
||||||
|
self.childOffset = visible - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.screen.on('resize', resize);
|
||||||
|
this.on('resize', resize);
|
||||||
}
|
}
|
||||||
|
|
||||||
List.prototype.__proto__ = ScrollableBox.prototype;
|
List.prototype.__proto__ = ScrollableBox.prototype;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user