Skip to content

Commit 20bd4a9

Browse files
committed
Move showOptionButtons into IFindInputOptions.showCommonFindToggles
Part of microsoft#156179
1 parent 866bddc commit 20bd4a9

File tree

9 files changed

+26
-18
lines changed

9 files changed

+26
-18
lines changed

src/vs/base/browser/ui/findinput/findInput.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface IFindInputOptions extends IFindInputStyles {
2727
readonly flexibleWidth?: boolean;
2828
readonly flexibleMaxHeight?: number;
2929

30+
readonly showCommonFindToggles?: boolean;
3031
readonly appendCaseSensitiveLabel?: string;
3132
readonly appendWholeWordsLabel?: string;
3233
readonly appendRegexLabel?: string;
@@ -100,7 +101,7 @@ export class FindInput extends Widget {
100101
private _onRegexKeyDown = this._register(new Emitter<IKeyboardEvent>());
101102
public readonly onRegexKeyDown: Event<IKeyboardEvent> = this._onRegexKeyDown.event;
102103

103-
constructor(parent: HTMLElement | null, contextViewProvider: IContextViewProvider, private readonly _showOptionButtons: boolean, options: IFindInputOptions) {
104+
constructor(parent: HTMLElement | null, contextViewProvider: IContextViewProvider, options: IFindInputOptions) {
104105
super();
105106
this.contextViewProvider = contextViewProvider;
106107
this.placeholder = options.placeholder || '';
@@ -243,12 +244,12 @@ export class FindInput extends Widget {
243244

244245
this.controls = document.createElement('div');
245246
this.controls.className = 'controls';
246-
this.controls.style.display = this._showOptionButtons ? 'block' : 'none';
247+
this.controls.style.display = options.showCommonFindToggles ? 'block' : 'none';
247248
this.controls.appendChild(this.caseSensitive.domNode);
248249
this.controls.appendChild(this.wholeWords.domNode);
249250
this.controls.appendChild(this.regex.domNode);
250251

251-
if (!this._showOptionButtons) {
252+
if (!options.showCommonFindToggles) {
252253
this.caseSensitive.domNode.style.display = 'none';
253254
this.wholeWords.domNode.style.display = 'none';
254255
this.regex.domNode.style.display = 'none';
@@ -273,7 +274,7 @@ export class FindInput extends Widget {
273274
}
274275

275276
this.inputBox.paddingRight =
276-
(this._showOptionButtons ? this.caseSensitive.width() + this.wholeWords.width() + this.regex.width() : 0)
277+
(options.showCommonFindToggles ? this.caseSensitive.width() + this.wholeWords.width() + this.regex.width() : 0)
277278
+ this.additionalToggles.reduce((r, t) => r + t.width(), 0);
278279

279280
this.domNode.appendChild(this.controls);

src/vs/base/browser/ui/tree/abstractTree.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,10 @@ class FindWidget<T, TFilterData> extends Disposable {
721721
this.modeToggle = this._register(new ModeToggle({ ...options, isChecked: mode === TreeFindMode.Filter }));
722722
this.onDidChangeMode = Event.map(this.modeToggle.onChange, () => this.modeToggle.checked ? TreeFindMode.Filter : TreeFindMode.Highlight, this._store);
723723

724-
this.findInput = this._register(new FindInput(this.elements.findInput, contextViewProvider, false, {
724+
this.findInput = this._register(new FindInput(this.elements.findInput, contextViewProvider, {
725725
label: localize('type to search', "Type to search"),
726-
additionalToggles: [this.modeToggle]
726+
additionalToggles: [this.modeToggle],
727+
showCommonFindToggles: false
727728
}));
728729

729730
this.actionbar = this._register(new ActionBar(this.elements.actionbar));

src/vs/editor/contrib/find/browser/findWidget.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,8 +979,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
979979
flexibleHeight,
980980
flexibleWidth,
981981
flexibleMaxHeight: 118,
982+
showCommonFindToggles: true,
982983
showHistoryHint: () => showHistoryKeybindingHint(this._keybindingService)
983-
}, this._contextKeyService, true));
984+
}, this._contextKeyService));
984985
this._findInput.setRegex(!!this._state.isRegex);
985986
this._findInput.setCaseSensitive(!!this._state.matchCase);
986987
this._findInput.setWholeWords(!!this._state.wholeWord);

src/vs/platform/history/browser/contextScopedHistoryWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ export class ContextScopedHistoryInputBox extends HistoryInputBox {
8989
export class ContextScopedFindInput extends FindInput {
9090

9191
constructor(container: HTMLElement | null, contextViewProvider: IContextViewProvider, options: IFindInputOptions,
92-
@IContextKeyService contextKeyService: IContextKeyService, showFindOptions: boolean = false
92+
@IContextKeyService contextKeyService: IContextKeyService
9393
) {
94-
super(container, contextViewProvider, showFindOptions, options);
94+
super(container, contextViewProvider, options);
9595
this._register(registerAndCreateHistoryNavigationContext(contextKeyService, this.inputBox));
9696
}
9797
}

src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const NLS_NEXT_MATCH_BTN_LABEL = nls.localize('label.nextMatchButton', "Next Mat
3232
const NLS_CLOSE_BTN_LABEL = nls.localize('label.closeButton', "Close");
3333

3434
interface IFindOptions {
35-
showOptionButtons?: boolean;
35+
showCommonFindToggles?: boolean;
3636
checkImeCompletionState?: boolean;
3737
showResultCount?: boolean;
3838
appendCaseSensitiveLabel?: string;
@@ -80,11 +80,12 @@ export abstract class SimpleFindWidget extends Widget {
8080
return { content: e.message };
8181
}
8282
},
83+
showCommonFindToggles: options.showCommonFindToggles,
8384
appendCaseSensitiveLabel: options.appendCaseSensitiveLabel && options.type === 'Terminal' ? this._getKeybinding(TerminalCommandId.ToggleFindCaseSensitive) : undefined,
8485
appendRegexLabel: options.appendRegexLabel && options.type === 'Terminal' ? this._getKeybinding(TerminalCommandId.ToggleFindRegex) : undefined,
8586
appendWholeWordsLabel: options.appendWholeWordsLabel && options.type === 'Terminal' ? this._getKeybinding(TerminalCommandId.ToggleFindWholeWord) : undefined,
8687
showHistoryHint: () => showHistoryKeybindingHint(_keybindingService)
87-
}, contextKeyService, options.showOptionButtons));
88+
}, contextKeyService));
8889
// Find History with update delayer
8990
this._updateHistoryDelayer = new Delayer<void>(500);
9091

src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ class NotebookFindInput extends FindInput {
160160
contextKeyService: IContextKeyService,
161161
readonly contextMenuService: IContextMenuService,
162162
readonly instantiationService: IInstantiationService,
163-
parent: HTMLElement | null, contextViewProvider: IContextViewProvider, showOptionButtons: boolean, options: IFindInputOptions) {
164-
super(parent, contextViewProvider, showOptionButtons, options);
163+
parent: HTMLElement | null,
164+
contextViewProvider: IContextViewProvider,
165+
options: IFindInputOptions
166+
) {
167+
super(parent, contextViewProvider, options);
165168

166169
this._register(registerAndCreateHistoryNavigationContext(contextKeyService, this.inputBox));
167170
this._filtersAction = new Action('notebookFindFilterAction', NOTEBOOK_FIND_FILTERS, 'notebook-filters ' + ThemeIcon.asClassName(filterIcon));
@@ -327,7 +330,6 @@ export abstract class SimpleFindReplaceWidget extends Widget {
327330
this.instantiationService,
328331
null,
329332
this._contextViewService,
330-
true,
331333
{
332334
label: NLS_FIND_INPUT_LABEL,
333335
placeholder: NLS_FIND_INPUT_PLACEHOLDER,
@@ -345,6 +347,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
345347
}
346348
},
347349
flexibleWidth: true,
350+
showCommonFindToggles: true
348351
}
349352
));
350353

src/vs/workbench/contrib/search/browser/searchWidget.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,12 @@ export class SearchWidget extends Widget {
314314
history: options.searchHistory,
315315
showHistoryHint: () => showHistoryKeybindingHint(this.keybindingService),
316316
flexibleHeight: true,
317-
flexibleMaxHeight: SearchWidget.INPUT_MAX_HEIGHT
317+
flexibleMaxHeight: SearchWidget.INPUT_MAX_HEIGHT,
318+
showCommonFindToggles: true
318319
};
319320

320321
const searchInputContainer = dom.append(parent, dom.$('.search-container.input-box'));
321-
this.searchInput = this._register(new ContextScopedFindInput(searchInputContainer, this.contextViewService, inputOptions, this.contextKeyService, true));
322+
this.searchInput = this._register(new ContextScopedFindInput(searchInputContainer, this.contextViewService, inputOptions, this.contextKeyService));
322323
this._register(attachFindReplaceInputBoxStyler(this.searchInput, this.themeService));
323324
this.searchInput.onKeyDown((keyboardEvent: IKeyboardEvent) => this.onSearchInputKeyDown(keyboardEvent));
324325
this.searchInput.setValue(options.value || '');

src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class TerminalFindWidget extends SimpleFindWidget {
3131
@IThemeService private readonly _themeService: IThemeService,
3232
@IConfigurationService private readonly _configurationService: IConfigurationService
3333
) {
34-
super(findState, { showOptionButtons: true, showResultCount: true, type: 'Terminal' }, _contextViewService, _contextKeyService, keybindingService);
34+
super(findState, { showCommonFindToggles: true, showResultCount: true, type: 'Terminal' }, _contextViewService, _contextKeyService, keybindingService);
3535

3636
this._register(findState.onFindReplaceStateChange(() => {
3737
this.show();

src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class WebviewFindWidget extends SimpleFindWidget {
3333
@IContextKeyService contextKeyService: IContextKeyService,
3434
@IKeybindingService keybindingService: IKeybindingService
3535
) {
36-
super(undefined, { showOptionButtons: false, checkImeCompletionState: _delegate.checkImeCompletionState }, contextViewService, contextKeyService, keybindingService);
36+
super(undefined, { showCommonFindToggles: false, checkImeCompletionState: _delegate.checkImeCompletionState }, contextViewService, contextKeyService, keybindingService);
3737
this._findWidgetFocused = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED.bindTo(contextKeyService);
3838

3939
this._register(_delegate.hasFindResult(hasResult => {

0 commit comments

Comments
 (0)