Add vtExtensions to demo
This commit is contained in:
@@ -119,9 +119,13 @@ export class OptionsWindow extends BaseWindow implements IControlWindow {
|
|||||||
'overviewRuler',
|
'overviewRuler',
|
||||||
'quirks',
|
'quirks',
|
||||||
'theme',
|
'theme',
|
||||||
|
'vtExtensions',
|
||||||
'windowOptions',
|
'windowOptions',
|
||||||
'windowsPty',
|
'windowsPty',
|
||||||
];
|
];
|
||||||
|
const nestedBooleanOptions: { label: string, parent: string, prop: string }[] = [
|
||||||
|
{ label: 'vtExtensions.kittyKeyboard', parent: 'vtExtensions', prop: 'kittyKeyboard' }
|
||||||
|
];
|
||||||
const stringOptions: { [key: string]: string[] | null } = {
|
const stringOptions: { [key: string]: string[] | null } = {
|
||||||
cursorStyle: ['block', 'underline', 'bar'],
|
cursorStyle: ['block', 'underline', 'bar'],
|
||||||
cursorInactiveStyle: ['outline', 'block', 'bar', 'underline', 'none'],
|
cursorInactiveStyle: ['outline', 'block', 'bar', 'underline', 'none'],
|
||||||
@@ -156,6 +160,10 @@ export class OptionsWindow extends BaseWindow implements IControlWindow {
|
|||||||
booleanOptions.forEach(o => {
|
booleanOptions.forEach(o => {
|
||||||
html += `<div class="option"><label><input id="opt-${o}" type="checkbox" ${this._terminal.options[o] ? 'checked' : ''}/> ${o}</label></div>`;
|
html += `<div class="option"><label><input id="opt-${o}" type="checkbox" ${this._terminal.options[o] ? 'checked' : ''}/> ${o}</label></div>`;
|
||||||
});
|
});
|
||||||
|
nestedBooleanOptions.forEach(({ label, parent, prop }) => {
|
||||||
|
const checked = this._terminal.options[parent]?.[prop] ?? false;
|
||||||
|
html += `<div class="option"><label><input id="opt-${label.replace('.', '-')}" type="checkbox" ${checked ? 'checked' : ''}/> ${label}</label></div>`;
|
||||||
|
});
|
||||||
html += '</div><div class="option-group">';
|
html += '</div><div class="option-group">';
|
||||||
numberOptions.forEach(o => {
|
numberOptions.forEach(o => {
|
||||||
html += `<div class="option"><label>${o} <input id="opt-${o}" type="number" value="${this._terminal.options[o] ?? ''}" step="${o === 'lineHeight' || o === 'scrollSensitivity' ? '0.1' : '1'}"/></label></div>`;
|
html += `<div class="option"><label>${o} <input id="opt-${o}" type="number" value="${this._terminal.options[o] ?? ''}" step="${o === 'lineHeight' || o === 'scrollSensitivity' ? '0.1' : '1'}"/></label></div>`;
|
||||||
@@ -187,6 +195,13 @@ export class OptionsWindow extends BaseWindow implements IControlWindow {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
nestedBooleanOptions.forEach(({ label, parent, prop }) => {
|
||||||
|
const input = document.getElementById(`opt-${label.replace('.', '-')}`) as HTMLInputElement;
|
||||||
|
addDomListener(input, 'change', () => {
|
||||||
|
console.log('change', label, input.checked);
|
||||||
|
this._terminal.options[parent] = { ...this._terminal.options[parent], [prop]: input.checked };
|
||||||
|
});
|
||||||
|
});
|
||||||
numberOptions.forEach(o => {
|
numberOptions.forEach(o => {
|
||||||
const input = document.getElementById(`opt-${o}`) as HTMLInputElement;
|
const input = document.getElementById(`opt-${o}`) as HTMLInputElement;
|
||||||
addDomListener(input, 'change', () => {
|
addDomListener(input, 'change', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user