Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get overview ruler color to upate #147116

Merged
merged 11 commits into from
Apr 13, 2022
20 changes: 17 additions & 3 deletions src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { FindReplaceState } from 'vs/editor/contrib/find/browser/findState';
import { ITerminalGroupService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
import { TerminalLocation } from 'vs/platform/terminal/common/terminal';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';

export class TerminalFindWidget extends SimpleFindWidget {
protected _findInputFocused: IContextKey<boolean>;
Expand All @@ -21,7 +23,9 @@ export class TerminalFindWidget extends SimpleFindWidget {
@IContextViewService _contextViewService: IContextViewService,
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
@ITerminalService private readonly _terminalService: ITerminalService,
@ITerminalGroupService private readonly _terminalGroupService: ITerminalGroupService
@ITerminalGroupService private readonly _terminalGroupService: ITerminalGroupService,
@IThemeService private readonly _themeService: IThemeService,
@IConfigurationService private readonly _configurationService: IConfigurationService
) {
super(_contextViewService, _contextKeyService, findState, { showOptionButtons: true, showResultCount: true });

Expand All @@ -31,15 +35,25 @@ export class TerminalFindWidget extends SimpleFindWidget {
this._findInputFocused = TerminalContextKeys.findInputFocus.bindTo(this._contextKeyService);
this._findWidgetFocused = TerminalContextKeys.findFocus.bindTo(this._contextKeyService);
this._findWidgetVisible = TerminalContextKeys.findVisible.bindTo(_contextKeyService);
this._register(this._themeService.onDidColorThemeChange(() => {
if (this._findWidgetVisible) {
this.find(true, true);
}
}));
this._register(this._configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration('workbench.colorCustomizations') && this._findWidgetVisible) {
this.find(true, true);
}
}));
}

find(previous: boolean) {
find(previous: boolean, update?: boolean) {
const instance = this._terminalService.activeInstance;
if (!instance) {
return;
}
if (previous) {
instance.xterm?.findPrevious(this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() });
instance.xterm?.findPrevious(this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue(), incremental: update });
} else {
instance.xterm?.findNext(this.inputValue, { regex: this._getRegexValue(), wholeWord: this._getWholeWordValue(), caseSensitive: this._getCaseSensitiveValue() });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
this._refreshStyles();
} else if (e.affectsConfiguration(TerminalSettingId.FontSize) || e.affectsConfiguration(TerminalSettingId.LineHeight)) {
this.refreshLayouts();
} else if (e.affectsConfiguration('workbench.colorCustomizations')) {
this._refreshStyles(true);
}
});
this._themeService.onDidColorThemeChange(() => this._refreshStyles(true));
Expand All @@ -94,10 +96,10 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
} else {
color = '';
}
if (decoration.decoration.overviewRulerOptions) {
decoration.decoration.overviewRulerOptions.color = color;
} else {
decoration.decoration.overviewRulerOptions = { color };
if (decoration.decoration.options?.overviewRulerOptions) {
decoration.decoration.options.overviewRulerOptions.color = color;
} else if (decoration.decoration.options) {
decoration.decoration.options.overviewRulerOptions = { color };
}
}
}
Expand Down