Fix #948
This commit is contained in:
+5
-1
@@ -11,6 +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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@@ -68,7 +69,10 @@ export class Buffer implements IBuffer {
|
|||||||
if (!this._hasScrollback) {
|
if (!this._hasScrollback) {
|
||||||
return rows;
|
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
@@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { BufferSet } from './BufferSet';
|
import { BufferSet } from './BufferSet';
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer, MAX_BUFFER_SIZE } from './Buffer';
|
||||||
import { CompositionHelper } from './CompositionHelper';
|
import { CompositionHelper } from './CompositionHelper';
|
||||||
import { EventEmitter } from './EventEmitter';
|
import { EventEmitter } from './EventEmitter';
|
||||||
import { Viewport } from './Viewport';
|
import { Viewport } from './Viewport';
|
||||||
@@ -384,6 +384,8 @@ 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;
|
||||||
|
|
||||||
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}`);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user