Context key should be manipulated outside of common find widget component.
parent
f11bde8155
commit
d347d59319
|
@ -12,7 +12,6 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
|||
import * as dom from 'vs/base/browser/dom';
|
||||
import { FindInput } from 'vs/base/browser/ui/findinput/findInput';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { registerThemingParticipant, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { inputBackground, inputActiveOptionBorder, inputForeground, inputBorder, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationErrorBackground, inputValidationErrorBorder, editorWidgetBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { SimpleButton } from './findWidget';
|
||||
|
@ -29,7 +28,6 @@ export abstract class SimpleFindWidget extends Widget {
|
|||
protected _isVisible: boolean;
|
||||
protected _focusTracker: dom.IFocusTracker;
|
||||
protected _findInputFocusTracker: dom.IFocusTracker;
|
||||
protected _findInputFocused: IContextKey<boolean>;
|
||||
protected _findHistory: HistoryNavigator<string>;
|
||||
protected _updateHistoryDelayer: Delayer<void>;
|
||||
|
||||
|
@ -113,8 +111,8 @@ export abstract class SimpleFindWidget extends Widget {
|
|||
this._register(this._focusTracker.addBlurListener(this.onFocusTrackerBlur.bind(this)));
|
||||
|
||||
this._findInputFocusTracker = this._register(dom.trackFocus(this._findInput.domNode));
|
||||
this._register(this._findInputFocusTracker.addFocusListener(this._onFindInputFocusTrackerFocus.bind(this)));
|
||||
this._register(this._findInputFocusTracker.addBlurListener(this._onFindInputFocusTrackerBlur.bind(this)));
|
||||
this._register(this._findInputFocusTracker.addFocusListener(this.onFindInputFocusTrackerFocus.bind(this)));
|
||||
this._register(this._findInputFocusTracker.addBlurListener(this.onFindInputFocusTrackerBlur.bind(this)));
|
||||
|
||||
this._register(dom.addDisposableListener(this._domNode, 'click', (event) => {
|
||||
event.stopPropagation();
|
||||
|
@ -125,6 +123,8 @@ export abstract class SimpleFindWidget extends Widget {
|
|||
protected abstract find(previous: boolean);
|
||||
protected abstract onFocusTrackerFocus();
|
||||
protected abstract onFocusTrackerBlur();
|
||||
protected abstract onFindInputFocusTrackerFocus();
|
||||
protected abstract onFindInputFocusTrackerBlur();
|
||||
|
||||
protected get inputValue() {
|
||||
return this._findInput.getValue();
|
||||
|
@ -207,14 +207,6 @@ export abstract class SimpleFindWidget extends Widget {
|
|||
this._findInput.setValue(previous);
|
||||
}
|
||||
}
|
||||
|
||||
private _onFindInputFocusTrackerFocus() {
|
||||
this._findInputFocused.set(true);
|
||||
}
|
||||
|
||||
private _onFindInputFocusTrackerBlur() {
|
||||
this._findInputFocused.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
// theming
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
import { SimpleFindWidget } from 'vs/editor/contrib/find/browser/simpleFindWidget';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED } from 'vs/workbench/parts/terminal/common/terminal';
|
||||
import { IContextKeyService, } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
export class TerminalFindWidget extends SimpleFindWidget {
|
||||
protected _findInputFocused: IContextKey<boolean>;
|
||||
|
||||
constructor(
|
||||
@IContextViewService _contextViewService: IContextViewService,
|
||||
|
@ -47,4 +48,12 @@ export class TerminalFindWidget extends SimpleFindWidget {
|
|||
protected onFocusTrackerBlur() {
|
||||
this._terminalService.getActiveInstance().notifyFindWidgetFocusChanged(false);
|
||||
}
|
||||
|
||||
protected onFindInputFocusTrackerFocus() {
|
||||
this._findInputFocused.set(true);
|
||||
}
|
||||
|
||||
protected onFindInputFocusTrackerBlur() {
|
||||
this._findInputFocused.reset();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue