提交 3b911340 编写于 作者: P Peng Lyu

select keybinding entry but not focus when editing keybindings.

上级 4e7348b8
......@@ -109,7 +109,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
) {
super(KeybindingsEditor.ID, telemetryService, themeService, storageService);
this.delayedFiltering = new Delayer<void>(300);
this._register(keybindingsService.onDidUpdateKeybindings(() => this.render(true)));
this._register(keybindingsService.onDidUpdateKeybindings(() => this.render(!!this.keybindingFocusContextKey.get())));
this.keybindingsEditorContextKey = CONTEXT_KEYBINDINGS_EDITOR.bindTo(this.contextKeyService);
this.searchFocusContextKey = CONTEXT_KEYBINDINGS_SEARCH_FOCUS.bindTo(this.contextKeyService);
......@@ -537,7 +537,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
this.unAssignedKeybindingItemToRevealAndFocus = null;
} else if (currentSelectedIndex !== -1 && currentSelectedIndex < this.listEntries.length) {
this.selectEntry(currentSelectedIndex);
this.selectEntry(currentSelectedIndex, preserveFocus);
} else if (this.editorService.activeControl === this && !preserveFocus) {
this.focus();
}
......@@ -597,11 +597,13 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
return -1;
}
private selectEntry(keybindingItemEntry: IKeybindingItemEntry | number): void {
private selectEntry(keybindingItemEntry: IKeybindingItemEntry | number, focus: boolean = true): void {
const index = typeof keybindingItemEntry === 'number' ? keybindingItemEntry : this.getIndexOf(keybindingItemEntry);
if (index !== -1) {
this.keybindingsList.getHTMLElement().focus();
this.keybindingsList.setFocus([index]);
if (focus) {
this.keybindingsList.getHTMLElement().focus();
this.keybindingsList.setFocus([index]);
}
this.keybindingsList.setSelection([index]);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册