Skip to content

Commit

Permalink
Cache font info to avoid excessive layout
Browse files Browse the repository at this point in the history
Fixes #223876
Fixes #223871
  • Loading branch information
Tyriar committed Jul 26, 2024
1 parent 64e4666 commit 7d6e919
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,21 +505,20 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
private _ensureSuggestWidget(terminal: Terminal): SimpleSuggestWidget {
this._terminalSuggestWidgetVisibleContextKey.set(true);
if (!this._suggestWidget) {
const c = this._terminalConfigurationService.config;
const font = this._terminalConfigurationService.getFont(dom.getActiveWindow());
const fontInfo = {
fontFamily: font.fontFamily,
fontSize: font.fontSize,
lineHeight: Math.ceil(1.5 * font.fontSize),
fontWeight: c.fontWeight.toString(),
letterSpacing: font.letterSpacing
};
this._suggestWidget = this._register(this._instantiationService.createInstance(
SimpleSuggestWidget,
this._panel!,
this._instantiationService.createInstance(PersistedWidgetSize),
() => {
const c = this._terminalConfigurationService.config;
const font = this._terminalConfigurationService.getFont(dom.getActiveWindow());
return {
fontFamily: font.fontFamily,
fontSize: font.fontSize,
lineHeight: Math.ceil(1.5 * font.fontSize),
fontWeight: c.fontWeight.toString(),
letterSpacing: font.letterSpacing
};
},
() => fontInfo,
{}
));
this._suggestWidget.list.style(getListStyles({
Expand Down

0 comments on commit 7d6e919

Please sign in to comment.