Skip to content

Commit e32ff82

Browse files
committed
PR fixes
1 parent 6cbb7a5 commit e32ff82

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/views/stream-view.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
var blessed = require("blessed");
44
var util = require("util");
55

6+
var MAX_OBJECT_LOG_DEPTH = 20;
7+
68
var StreamView = function StreamView(options) {
79

810
this.scrollBox = blessed.log({
@@ -45,23 +47,19 @@ StreamView.prototype.onEvent = function (data) {
4547
// the original method calls shiftLine with two parameters (start, end)
4648
// when it should call it with just one (num lines to shift out)
4749
// blessed v0.1.81 - https://github.com/chjj/blessed/issues/255
48-
// disable eslint for the next section since it is a copy/fix from the original
49-
// blessed log.js codebase
50-
/* eslint-disable */
5150
blessed.log.prototype.log =
52-
blessed.log.prototype.add = function() {
51+
blessed.log.prototype.add = function add() {
5352
var args = Array.prototype.slice.call(arguments);
54-
if (typeof args[0] === 'object') {
55-
args[0] = util.inspect(args[0], true, 20, true);
53+
if (typeof args[0] === "object") {
54+
args[0] = util.inspect(args[0], { showHidden: true, depth: MAX_OBJECT_LOG_DEPTH });
5655
}
5756
var text = util.format.apply(util, args);
58-
this.emit('log', text);
57+
this.emit("log", text);
5958
var ret = this.pushLine(text);
60-
if (this._clines.fake.length > this.scrollback) {
61-
this.shiftLine((this.scrollback / 3) | 0); // fixed line
59+
if (this.scrollback && this._clines.fake.length > this.scrollback) {
60+
this.shiftLine(this._clines.fake.length - this.scrollback);
6261
}
6362
return ret;
6463
};
65-
/* eslint-enable */
6664

6765
module.exports = StreamView;

0 commit comments

Comments
 (0)