colsElement.addEventListener('change', setTerminalSize);
rowsElement.addEventListener('change', setTerminalSize);
-optionElements.cursorBlink.addEventListener('change', createTerminal);
+optionElements.cursorBlink.addEventListener('change', function () {
+ term.setOption('cursorBlink', optionElements.cursorBlink.checked);
+});
+ optionElements.scrollback.addEventListener('change', function () {
+ terminal.setOption('scrollback', parseInt(optionElements.scrollback.value, 10));
+ });
createTerminal();
if (!(key in Terminal.defaults)) {
throw new Error('No option with key "' + key + '"');
}
+ switch (key) {
+ case 'scrollback':
+ if (this.options[key] !== value) {
+ if (this.lines.length > value) {
+ const amountToTrim = this.lines.length - value;
+ const needsRefresh = (this.ydisp - amountToTrim < 0);
+ this.lines.trimStart(amountToTrim);
+ this.ybase = Math.max(this.ybase - amountToTrim, 0);
+ this.ydisp = Math.max(this.ydisp - amountToTrim, 0);
+ if (needsRefresh) {
+ this.refresh(0, this.rows - 1);
+ }
+ }
+ this.lines.maxLength = value;
+ this.viewport.syncScrollArea();
+ }
+ break;
+ }
this[key] = value;
this.options[key] = value;
+ switch (key) {
+ case 'cursorBlink': this.element.classList.toggle('xterm-cursor-blink', value); break;
+ }
};
/**