-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
type/debtTechnical debt that could slow us down in the long runTechnical debt that could slow us down in the long run
Milestone
Description
Currently we only have the onOptionChange event:
| this._onOptionChange.fire(propName); |
Which leads to checking the options on the other side, this is especially ugly in the larger files:
xterm.js/src/browser/Terminal.ts
Lines 273 to 317 in a22ad76
| // When the font changes the size of the cells may change which requires a renderer clear | |
| this._renderService?.clear(); | |
| this._charSizeService?.measure(); | |
| break; | |
| case 'cursorBlink': | |
| case 'cursorStyle': | |
| // The DOM renderer needs a row refresh to update the cursor styles | |
| this.refresh(this.buffer.y, this.buffer.y); | |
| break; | |
| case 'customGlyphs': | |
| case 'drawBoldTextInBrightColors': | |
| case 'letterSpacing': | |
| case 'lineHeight': | |
| case 'fontWeight': | |
| case 'fontWeightBold': | |
| case 'minimumContrastRatio': | |
| // When the font changes the size of the cells may change which requires a renderer clear | |
| if (this._renderService) { | |
| this._renderService.clear(); | |
| this._renderService.handleResize(this.cols, this.rows); | |
| this.refresh(0, this.rows - 1); | |
| } | |
| break; | |
| case 'scrollback': | |
| this.viewport?.syncScrollArea(); | |
| break; | |
| case 'screenReaderMode': | |
| if (this.optionsService.rawOptions.screenReaderMode) { | |
| if (!this._accessibilityManager && this._renderService) { | |
| this._accessibilityManager = new AccessibilityManager(this, this._renderService); | |
| } | |
| } else { | |
| this._accessibilityManager?.dispose(); | |
| this._accessibilityManager = undefined; | |
| } | |
| break; | |
| case 'tabStopWidth': this.buffers.setupTabStops(); break; | |
| case 'theme': | |
| this._setTheme(this.optionsService.rawOptions.theme); | |
| break; | |
| } | |
| } | |
| /** | |
| * Binds the desired focus behavior on a given terminal object. |
This sort of thing would encapsulate this repetitive pattern inside options service:
IOptionsService.onSpecificOptionChange(key: 'x' | 'y' | ..., listener: () => voidMetadata
Metadata
Assignees
Labels
type/debtTechnical debt that could slow us down in the long runTechnical debt that could slow us down in the long run