|
3 | 3 | var blessed = require("blessed");
|
4 | 4 | var util = require("util");
|
5 | 5 |
|
| 6 | +var MAX_OBJECT_LOG_DEPTH = 20; |
| 7 | + |
6 | 8 | var StreamView = function StreamView(options) {
|
7 | 9 |
|
8 | 10 | this.scrollBox = blessed.log({
|
@@ -45,23 +47,19 @@ StreamView.prototype.onEvent = function (data) {
|
45 | 47 | // the original method calls shiftLine with two parameters (start, end)
|
46 | 48 | // when it should call it with just one (num lines to shift out)
|
47 | 49 | // 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 */ |
51 | 50 | blessed.log.prototype.log =
|
52 |
| -blessed.log.prototype.add = function() { |
| 51 | +blessed.log.prototype.add = function add() { |
53 | 52 | 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 }); |
56 | 55 | }
|
57 | 56 | var text = util.format.apply(util, args);
|
58 |
| - this.emit('log', text); |
| 57 | + this.emit("log", text); |
59 | 58 | 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); |
62 | 61 | }
|
63 | 62 | return ret;
|
64 | 63 | };
|
65 |
| -/* eslint-enable */ |
66 | 64 |
|
67 | 65 | module.exports = StreamView;
|
0 commit comments