Added scrolling.
This commit is contained in:
parent
f3c9afc684
commit
826db2d718
|
@ -86,6 +86,20 @@ function ANSIEscapeParser(options) {
|
|||
};
|
||||
|
||||
self.positionUpdated = function () {
|
||||
if(self.row > self.termHeight) {
|
||||
if(this.savedPosition) {
|
||||
this.savedPosition.row -= self.row - self.termHeight;
|
||||
}
|
||||
self.emit('scroll', self.row - self.termHeight);
|
||||
self.row = self.termHeight;
|
||||
}
|
||||
else if(self.row < 1) {
|
||||
if(this.savedPosition) {
|
||||
this.savedPosition.row -= self.row - 1;
|
||||
}
|
||||
self.emit('scroll', -(self.row - 1));
|
||||
self.row = 1;
|
||||
}
|
||||
self.emit('position update', self.row, self.column);
|
||||
};
|
||||
|
||||
|
|
|
@ -316,6 +316,12 @@ function display(client, art, options, cb) {
|
|||
}
|
||||
});
|
||||
|
||||
ansiParser.on('scroll', (scrollY) => {
|
||||
_.forEach(mciMap, (mciInfo) => {
|
||||
mciInfo.position[0] -= scrollY;
|
||||
});
|
||||
});
|
||||
|
||||
ansiParser.on('literal', literal => client.term.write(literal, false));
|
||||
ansiParser.on('control', control => client.term.rawWrite(control));
|
||||
|
||||
|
|
Loading…
Reference in New Issue