提交 ce731779 编写于 作者: D Daniel Imms

Minimize diff

上级 b41f6bfa
...@@ -36,18 +36,16 @@ export abstract class SimpleFindWidget extends Widget { ...@@ -36,18 +36,16 @@ export abstract class SimpleFindWidget extends Widget {
private prevBtn: SimpleButton; private prevBtn: SimpleButton;
private nextBtn: SimpleButton; private nextBtn: SimpleButton;
private foundMatch: boolean; private foundMatch: boolean;
private readonly _invertDefaultDirection: boolean | undefined;
constructor( constructor(
@IContextViewService private readonly _contextViewService: IContextViewService, @IContextViewService private readonly _contextViewService: IContextViewService,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
private readonly _state: FindReplaceState = new FindReplaceState(), private readonly _state: FindReplaceState = new FindReplaceState(),
showOptionButtons?: boolean, showOptionButtons?: boolean,
invertDefaultDirection?: boolean private readonly _invertDefaultDirection: boolean = false
) { ) {
super(); super();
this._invertDefaultDirection = invertDefaultDirection;
this._findInput = this._register(new ContextScopedFindInput(null, this._contextViewService, { this._findInput = this._register(new ContextScopedFindInput(null, this._contextViewService, {
label: NLS_FIND_INPUT_LABEL, label: NLS_FIND_INPUT_LABEL,
placeholder: NLS_FIND_INPUT_PLACEHOLDER, placeholder: NLS_FIND_INPUT_PLACEHOLDER,
...@@ -96,14 +94,13 @@ export abstract class SimpleFindWidget extends Widget { ...@@ -96,14 +94,13 @@ export abstract class SimpleFindWidget extends Widget {
this._register(this._findInput.onKeyDown((e) => { this._register(this._findInput.onKeyDown((e) => {
if (e.equals(KeyCode.Enter)) { if (e.equals(KeyCode.Enter)) {
// Flip the direction search goes in the terminal case so it matches other terminals this.find(this._invertDefaultDirection);
this.find(this._invertDefaultDirection ? true : false);
e.preventDefault(); e.preventDefault();
return; return;
} }
if (e.equals(KeyMod.Shift | KeyCode.Enter)) { if (e.equals(KeyMod.Shift | KeyCode.Enter)) {
this.find(this._invertDefaultDirection ? false : true); this.find(!this._invertDefaultDirection);
e.preventDefault(); e.preventDefault();
return; return;
} }
......
...@@ -8,6 +8,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView ...@@ -8,6 +8,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_FOCUSED } from 'vs/workbench/contrib/terminal/common/terminal'; import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_FOCUSED } from 'vs/workbench/contrib/terminal/common/terminal';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { FindReplaceState } from 'vs/editor/contrib/find/findState'; import { FindReplaceState } from 'vs/editor/contrib/find/findState';
export class TerminalFindWidget extends SimpleFindWidget { export class TerminalFindWidget extends SimpleFindWidget {
protected _findInputFocused: IContextKey<boolean>; protected _findInputFocused: IContextKey<boolean>;
protected _findWidgetFocused: IContextKey<boolean>; protected _findWidgetFocused: IContextKey<boolean>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册