Fix review comments

This commit is contained in:
Bruno Ribeito
2017-11-05 21:13:54 +00:00
parent b7438d57cf
commit 9c4ff54f22
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ export const CHAR_DATA_ATTR_INDEX = 0;
export const CHAR_DATA_CHAR_INDEX = 1; export const CHAR_DATA_CHAR_INDEX = 1;
export const CHAR_DATA_WIDTH_INDEX = 2; export const CHAR_DATA_WIDTH_INDEX = 2;
export const CHAR_DATA_CODE_INDEX = 3; export const CHAR_DATA_CODE_INDEX = 3;
export const MAX_BUFFER_SIZE = -1 >>> 0; // 2^32 - 1 export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1
/** /**
* This class represents a terminal buffer (an internal state of the terminal), where the * This class represents a terminal buffer (an internal state of the terminal), where the
@@ -70,9 +70,9 @@ export class Buffer implements IBuffer {
return rows; return rows;
} }
const correctBuferLength = rows + this._terminal.options.scrollback; const correctBufferLength = rows + this._terminal.options.scrollback;
return correctBuferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBuferLength; return correctBufferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBufferLength;
} }
/** /**
+1 -1
View File
@@ -384,7 +384,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
} }
break; break;
case 'scrollback': case 'scrollback':
value = value > 0 && value <= MAX_BUFFER_SIZE ? value : MAX_BUFFER_SIZE; value = Math.min(value, MAX_BUFFER_SIZE);
if (value < 0) { if (value < 0) {
console.warn(`${key} cannot be less than 0, value: ${value}`); console.warn(`${key} cannot be less than 0, value: ${value}`);