提交 f8ad345f 编写于 作者: J Johannes Rieken

breadcrumbs - make tab select an item from the picker, also tweak arrow key behaviour

上级 e4279700
......@@ -654,19 +654,21 @@ export class HighlightingWorkbenchTree extends WorkbenchTree {
this.input.onDidChange(this.updateHighlights, this, this.disposables);
this.disposables.push(attachInputBoxStyler(this.input, themeService));
this.disposables.push(this.input);
this.disposables.push(addStandardDisposableListener(this.input.inputElement, 'keyup', event => {
this.disposables.push(addStandardDisposableListener(this.input.inputElement, 'keydown', event => {
//todo@joh make this command/context-key based
if (event.keyCode === KeyCode.DownArrow) {
this.focusNext();
this.domFocus();
} else if (event.keyCode === KeyCode.UpArrow) {
this.focusPrevious();
this.domFocus();
} else if (event.keyCode === KeyCode.Enter) {
this.setSelection(this.getSelection());
} else if (event.keyCode === KeyCode.Escape) {
this.input.value = '';
this.domFocus();
switch (event.keyCode) {
case KeyCode.DownArrow:
case KeyCode.UpArrow:
this.domFocus();
break;
case KeyCode.Enter:
case KeyCode.Tab:
this.setSelection(this.getSelection());
break;
case KeyCode.Escape:
this.input.value = '';
this.domFocus();
break;
}
}));
}
......
......@@ -37,6 +37,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { localize } from 'vs/nls';
import { WorkbenchListFocusContextKey, IListService } from 'vs/platform/list/browser/listService';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
class Item extends BreadcrumbsItem {
......@@ -414,5 +416,16 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
groups.activeGroup.activeControl.focus();
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'breadcrumbs.pickFromTree',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
primary: KeyCode.Tab,
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive, WorkbenchListFocusContextKey),
handler(accessor) {
const list = accessor.get(IListService).lastFocusedList;
if (list instanceof Tree) {
list.setSelection([list.getFocus()]);
}
}
});
//#endregion
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册