This commit is contained in:
Bruno Ribeito
2017-11-05 15:11:02 +00:00
parent 3921457bf3
commit b7438d57cf
2 changed files with 8 additions and 2 deletions
+5 -1
View File
@@ -11,6 +11,7 @@ export const CHAR_DATA_ATTR_INDEX = 0;
export const CHAR_DATA_CHAR_INDEX = 1;
export const CHAR_DATA_WIDTH_INDEX = 2;
export const CHAR_DATA_CODE_INDEX = 3;
export const MAX_BUFFER_SIZE = -1 >>> 0; // 2^32 - 1
/**
* This class represents a terminal buffer (an internal state of the terminal), where the
@@ -68,7 +69,10 @@ export class Buffer implements IBuffer {
if (!this._hasScrollback) {
return rows;
}
return rows + this._terminal.options.scrollback;
const correctBuferLength = rows + this._terminal.options.scrollback;
return correctBuferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBuferLength;
}
/**
+3 -1
View File
@@ -22,7 +22,7 @@
*/
import { BufferSet } from './BufferSet';
import { Buffer } from './Buffer';
import { Buffer, MAX_BUFFER_SIZE } from './Buffer';
import { CompositionHelper } from './CompositionHelper';
import { EventEmitter } from './EventEmitter';
import { Viewport } from './Viewport';
@@ -384,6 +384,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
}
break;
case 'scrollback':
value = value > 0 && value <= MAX_BUFFER_SIZE ? value : MAX_BUFFER_SIZE;
if (value < 0) {
console.warn(`${key} cannot be less than 0, value: ${value}`);
return;