Skip to content

Commit 880b726

Browse files
authored
Merge pull request #4325 from Tyriar/4056
Fix canvas renderer selection not re-rendering sometimes
2 parents 902da28 + 2bd9c4e commit 880b726

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
@@ -454,12 +454,16 @@ export class Terminal extends CoreTerminal implements ITerminal {
454454
this.textarea.setAttribute('autocapitalize', 'off');
455455
this.textarea.setAttribute('spellcheck', 'false');
456456
this.textarea.tabIndex = 0;
457+
458+
// Register the core browser service before the generic textarea handlers are registered so it
459+
// handles them first. Otherwise the renderers may use the wrong focus state.
460+
this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, this._document.defaultView ?? window);
461+
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
462+
457463
this.register(addDisposableDomListener(this.textarea, 'focus', (ev: KeyboardEvent) => this._handleTextAreaFocus(ev)));
458464
this.register(addDisposableDomListener(this.textarea, 'blur', () => this._handleTextAreaBlur()));
459465
this._helperContainer.appendChild(this.textarea);
460466

461-
this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, this._document.defaultView ?? window);
462-
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
463467

464468
this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);
465469
this._instantiationService.setService(ICharSizeService, this._charSizeService);

0 commit comments

Comments
 (0)