var prompt = this._initialPrompt;
if (this.bufferedCommand.length) {
prompt = '...';
- var levelInd = new Array(this.lines.level.length).join('..');
+ const len = this.lines.level.length ? this.lines.level.length - 1 : 0;
+ const levelInd = '..'.repeat(len);
prompt += levelInd + ' ';
}
// save the line so I can do magic later
if (cmd) {
// TODO should I tab the level?
- self.lines.push(new Array(self.lines.level.length).join(' ') + cmd);
+ const len = self.lines.level.length ? self.lines.level.length - 1 : 0;
+ self.lines.push(' '.repeat(len) + cmd);
} else {
// I don't want to not change the format too much...
self.lines.push('');