console error on setting ctor only option via setOption

This commit is contained in:
Daniel Imms
2018-06-03 11:02:39 +01:00
parent 4d5e305a25
commit 5b04451b05
2 changed files with 42 additions and 8 deletions
+8
View File
@@ -94,6 +94,11 @@ const WRITE_BUFFER_PAUSE_THRESHOLD = 5;
*/
const WRITE_BATCH_SIZE = 300;
/**
* The set of options that only have an effect when set in the Terminal constructor.
*/
const CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows', 'experimentalCharAtlas'];
const DEFAULT_OPTIONS: ITerminalOptions = {
cols: 80,
rows: 24,
@@ -400,6 +405,9 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
if (!(key in DEFAULT_OPTIONS)) {
throw new Error('No option with key "' + key + '"');
}
if (CONSTRUCTOR_ONLY_OPTIONS.indexOf(key) !== -1) {
console.error(`Option "${key}" can only be set in the constructor`);
}
switch (key) {
case 'bellStyle':
if (!value) {