Skip to content

Commit

Permalink
search viewlet: fix subpixel aa in panel
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Nov 19, 2019
1 parent 16d8984 commit 515a0cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { OpenSymbolHandler } from 'vs/workbench/contrib/search/browser/openSymbo
import { registerContributions as replaceContributions } from 'vs/workbench/contrib/search/browser/replaceContributions';
import { clearHistoryCommand, ClearSearchResultsAction, CloseReplaceAction, CollapseDeepestExpandedLevelAction, copyAllCommand, copyMatchCommand, copyPathCommand, FocusNextInputAction, FocusNextSearchResultAction, FocusPreviousInputAction, FocusPreviousSearchResultAction, focusSearchListCommand, getSearchView, openSearchView, OpenSearchViewletAction, RefreshAction, RemoveAction, ReplaceAction, ReplaceAllAction, ReplaceAllInFolderAction, ReplaceInFilesAction, toggleCaseSensitiveCommand, toggleRegexCommand, toggleWholeWordCommand, FindInFilesCommand, ToggleSearchOnTypeAction } from 'vs/workbench/contrib/search/browser/searchActions';
import { SearchPanel } from 'vs/workbench/contrib/search/browser/searchPanel';
import { SearchView } from 'vs/workbench/contrib/search/browser/searchView';
import { SearchView, SearchViewPosition } from 'vs/workbench/contrib/search/browser/searchView';
import { SearchViewlet } from 'vs/workbench/contrib/search/browser/searchViewlet';
import { registerContributions as searchWidgetContributions } from 'vs/workbench/contrib/search/browser/searchWidget';
import * as Constants from 'vs/workbench/contrib/search/common/constants';
Expand Down Expand Up @@ -542,7 +542,7 @@ class RegisterSearchViewContribution implements IWorkbenchContribution {
}
} else {
Registry.as<PanelRegistry>(PanelExtensions.Panels).deregisterPanel(PANEL_ID);
viewsRegistry.registerViews([{ id: VIEW_ID, name: nls.localize('search', "Search"), ctorDescriptor: { ctor: SearchView }, canToggleVisibility: false }], VIEW_CONTAINER);
viewsRegistry.registerViews([{ id: VIEW_ID, name: nls.localize('search', "Search"), ctorDescriptor: { ctor: SearchView, arguments: [SearchViewPosition.SideBar] }, canToggleVisibility: false }], VIEW_CONTAINER);
if (open) {
viewletService.openViewlet(VIEWLET_ID);
}
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/search/browser/searchPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { PANEL_ID } from 'vs/workbench/services/search/common/search';
import { SearchView } from 'vs/workbench/contrib/search/browser/searchView';
import { SearchView, SearchViewPosition } from 'vs/workbench/contrib/search/browser/searchView';
import { Panel } from 'vs/workbench/browser/panel';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { localize } from 'vs/nls';
Expand All @@ -25,7 +25,7 @@ export class SearchPanel extends Panel {
@IInstantiationService instantiationService: IInstantiationService,
) {
super(PANEL_ID, telemetryService, themeService, storageService);
this.searchView = this._register(instantiationService.createInstance(SearchView, { id: PANEL_ID, title: localize('search', "Search"), actionRunner: this.getActionRunner() }));
this.searchView = this._register(instantiationService.createInstance(SearchView, SearchViewPosition.Panel, { id: PANEL_ID, title: localize('search', "Search"), actionRunner: this.getActionRunner() }));
this._register(this.searchView.onDidChangeTitleArea(() => this.updateTitleArea()));
this._register(this.onDidChangeVisibility(visible => this.searchView.setVisible(visible)));
}
Expand Down
12 changes: 9 additions & 3 deletions src/vs/workbench/contrib/search/browser/searchView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { Memento, MementoObject } from 'vs/workbench/common/memento';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { SIDE_BAR_BACKGROUND, PANEL_BACKGROUND } from 'vs/workbench/common/theme';

const $ = dom.$;

Expand All @@ -71,6 +71,11 @@ enum SearchUIState {
SlowSearch
}

export enum SearchViewPosition {
SideBar,
Panel
}

const SEARCH_CANCELLED_MESSAGE = nls.localize('searchCanceled', "Search was canceled before any results could be found - ");
export class SearchView extends ViewletPanel {

Expand Down Expand Up @@ -133,6 +138,7 @@ export class SearchView extends ViewletPanel {
private addToSearchHistoryDelayer: Delayer<void>;

constructor(
private position: SearchViewPosition,
options: IViewletPanelOptions,
@IFileService private readonly fileService: IFileService,
@IEditorService private readonly editorService: IEditorService,
Expand All @@ -157,7 +163,7 @@ export class SearchView extends ViewletPanel {
@IStorageService storageService: IStorageService,
@IOpenerService private readonly openerService: IOpenerService
) {
super({ ...(options as IViewletPanelOptions), id: VIEW_ID, ariaHeaderLabel: nls.localize('searchView', "Search") }, keybindingService, contextMenuService, configurationService, contextKeyService);
super({ ...options, id: VIEW_ID, ariaHeaderLabel: nls.localize('searchView', "Search") }, keybindingService, contextMenuService, configurationService, contextKeyService);

this.viewletVisible = Constants.SearchViewVisibleKey.bindTo(contextKeyService);
this.viewletFocused = Constants.SearchViewFocusedKey.bindTo(contextKeyService);
Expand Down Expand Up @@ -654,7 +660,7 @@ export class SearchView extends ViewletPanel {
dnd: this.instantiationService.createInstance(SearchDND),
multipleSelectionSupport: false,
overrideStyles: {
listBackground: SIDE_BAR_BACKGROUND
listBackground: this.position === SearchViewPosition.SideBar ? SIDE_BAR_BACKGROUND : PANEL_BACKGROUND
}
}));
this._register(this.tree.onContextMenu(e => this.onContextMenu(e)));
Expand Down

0 comments on commit 515a0cb

Please sign in to comment.