提交 ba4aa7a6 编写于 作者: J João Moreno

fixes #101432

上级 5c112d77
...@@ -79,6 +79,8 @@ import { Command } from 'vs/editor/common/modes'; ...@@ -79,6 +79,8 @@ import { Command } from 'vs/editor/common/modes';
import { renderCodicons } from 'vs/base/common/codicons'; import { renderCodicons } from 'vs/base/common/codicons';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar'; import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { domEvent } from 'vs/base/browser/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
type TreeElement = ISCMRepository | ISCMInput | ISCMResourceGroup | IResourceNode<ISCMResource, ISCMResourceGroup> | ISCMResource; type TreeElement = ISCMRepository | ISCMInput | ISCMResourceGroup | IResourceNode<ISCMResource, ISCMResourceGroup> | ISCMResource;
...@@ -272,6 +274,7 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore, ...@@ -272,6 +274,7 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore,
constructor( constructor(
private outerLayout: ISCMLayout, private outerLayout: ISCMLayout,
private updateHeight: (input: ISCMInput, height: number) => void, private updateHeight: (input: ISCMInput, height: number) => void,
private focusTree: () => void,
@IInstantiationService private instantiationService: IInstantiationService, @IInstantiationService private instantiationService: IInstantiationService,
) { } ) { }
...@@ -279,10 +282,16 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore, ...@@ -279,10 +282,16 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore,
// hack // hack
addClass(container.parentElement!.parentElement!.querySelector('.monaco-tl-twistie')! as HTMLElement, 'force-no-twistie'); addClass(container.parentElement!.parentElement!.querySelector('.monaco-tl-twistie')! as HTMLElement, 'force-no-twistie');
const disposables = new DisposableStore();
const inputElement = append(container, $('.scm-input')); const inputElement = append(container, $('.scm-input'));
const inputWidget = this.instantiationService.createInstance(SCMInputWidget, inputElement); const inputWidget = this.instantiationService.createInstance(SCMInputWidget, inputElement);
disposables.add(inputWidget);
const onKeyDown = Event.map(domEvent(container, 'keydown'), e => new StandardKeyboardEvent(e));
const onEscape = Event.filter(onKeyDown, e => e.keyCode === KeyCode.Escape);
disposables.add(onEscape(this.focusTree));
return { inputWidget, disposable: Disposable.None, templateDisposable: inputWidget }; return { inputWidget, disposable: Disposable.None, templateDisposable: disposables };
} }
renderElement(node: ITreeNode<ISCMInput, FuzzyScore>, index: number, templateData: InputTemplate): void { renderElement(node: ITreeNode<ISCMInput, FuzzyScore>, index: number, templateData: InputTemplate): void {
...@@ -1541,7 +1550,7 @@ export class SCMViewPane extends ViewPane { ...@@ -1541,7 +1550,7 @@ export class SCMViewPane extends ViewPane {
this._register(repositories.onDidSplice(() => this.updateActions())); this._register(repositories.onDidSplice(() => this.updateActions()));
this.inputRenderer = this.instantiationService.createInstance(InputRenderer, this.layoutCache, (input, height) => this.tree.updateElementHeight(input, height)); this.inputRenderer = this.instantiationService.createInstance(InputRenderer, this.layoutCache, (input, height) => this.tree.updateElementHeight(input, height), () => this.tree.domFocus());
const delegate = new ProviderListDelegate(this.inputRenderer); const delegate = new ProviderListDelegate(this.inputRenderer);
const actionViewItemProvider = (action: IAction) => this.getActionViewItem(action); const actionViewItemProvider = (action: IAction) => this.getActionViewItem(action);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册