This commit is contained in:
Megan Rogge
2023-01-19 16:49:53 +00:00
committed by GitHub
parent 41dc93a008
commit 77870b06b9
+5 -3
View File
@@ -93,7 +93,7 @@ export class AccessibilityManager extends Disposable {
this._accessiblityBuffer.ariaLabel = Strings.accessibilityBuffer; this._accessiblityBuffer.ariaLabel = Strings.accessibilityBuffer;
this._accessiblityBuffer.classList.add('xterm-accessibility-buffer'); this._accessiblityBuffer.classList.add('xterm-accessibility-buffer');
// TODO: this is needed when content editable is false // HACK: this is needed when content editable is false
this._refreshAccessibilityBuffer(); this._refreshAccessibilityBuffer();
this._accessiblityBuffer.addEventListener('focus', () => this._refreshAccessibilityBuffer()); this._accessiblityBuffer.addEventListener('focus', () => this._refreshAccessibilityBuffer());
this._terminal.element.insertAdjacentElement('afterbegin', this._accessiblityBuffer); this._terminal.element.insertAdjacentElement('afterbegin', this._accessiblityBuffer);
@@ -114,7 +114,7 @@ export class AccessibilityManager extends Disposable {
this._handleColorChange(themeService.colors); this._handleColorChange(themeService.colors);
this.register(themeService.onChangeColors(e => this._handleColorChange(e))); this.register(themeService.onChangeColors(e => this._handleColorChange(e)));
this._handleFontOptionChange(optionsService.options); this._handleFontOptionChange(optionsService.options);
this.register(optionsService.onMultipleOptionChange(['fontSize', 'fontFamily'], () => this._handleFontOptionChange(optionsService.options))); this.register(optionsService.onMultipleOptionChange(['fontSize', 'fontFamily', 'letterSpacing', 'lineHeight'], () => this._handleFontOptionChange(optionsService.options)));
this._screenDprMonitor = new ScreenDprMonitor(window); this._screenDprMonitor = new ScreenDprMonitor(window);
this.register(this._screenDprMonitor); this.register(this._screenDprMonitor);
@@ -325,7 +325,7 @@ export class AccessibilityManager extends Disposable {
return; return;
} }
const { bufferElements, cursorElement } = this._terminal.viewport.getBufferElements(0); const { bufferElements } = this._terminal.viewport.getBufferElements(0);
for (const element of bufferElements) { for (const element of bufferElements) {
if (element.textContent) { if (element.textContent) {
element.textContent = element.textContent.replace(new RegExp(' ', 'g'), '\xA0'); element.textContent = element.textContent.replace(new RegExp(' ', 'g'), '\xA0');
@@ -346,5 +346,7 @@ export class AccessibilityManager extends Disposable {
private _handleFontOptionChange(options: Required<ITerminalOptions>): void { private _handleFontOptionChange(options: Required<ITerminalOptions>): void {
this._accessiblityBuffer.style.fontFamily = options.fontFamily; this._accessiblityBuffer.style.fontFamily = options.fontFamily;
this._accessiblityBuffer.style.fontSize = `${options.fontSize}px`; this._accessiblityBuffer.style.fontSize = `${options.fontSize}px`;
this._accessiblityBuffer.style.lineHeight = `${options.lineHeight * this._renderService.dimensions.css.cell.height}px`;
this._accessiblityBuffer.style.letterSpacing = `${options.letterSpacing}px`;
} }
} }