Skip to content

Commit 2bd9c4e

Browse files
committed
Fix canvas renderer selection not re-rendering sometimes
Fixes #4056
1 parent 1c7c4eb commit 2bd9c4e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/browser/Terminal.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,16 @@ export class Terminal extends CoreTerminal implements ITerminal {
450450
this.textarea.setAttribute('autocapitalize', 'off');
451451
this.textarea.setAttribute('spellcheck', 'false');
452452
this.textarea.tabIndex = 0;
453+
454+
// Register the core browser service before the generic textarea handlers are registered so it
455+
// handles them first. Otherwise the renderers may use the wrong focus state.
456+
this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, this._document.defaultView ?? window);
457+
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
458+
453459
this.register(addDisposableDomListener(this.textarea, 'focus', (ev: KeyboardEvent) => this._handleTextAreaFocus(ev)));
454460
this.register(addDisposableDomListener(this.textarea, 'blur', () => this._handleTextAreaBlur()));
455461
this._helperContainer.appendChild(this.textarea);
456462

457-
this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, this._document.defaultView ?? window);
458-
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
459463

460464
this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);
461465
this._instantiationService.setService(ICharSizeService, this._charSizeService);

0 commit comments

Comments
 (0)