提交 23bee232 编写于 作者: B Benjamin Pasero

fix #39780

上级 9ec7172f
......@@ -16,7 +16,7 @@ import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLa
import { IAction } from 'vs/base/common/actions';
import { ActionBar, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { EditorInput } from 'vs/workbench/common/editor';
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { KeybindingsEditorModel, IKeybindingItemEntry, IListEntry, KEYBINDING_ENTRY_TEMPLATE_ID, KEYBINDING_HEADER_TEMPLATE_ID } from 'vs/workbench/parts/preferences/common/keybindingsEditorModel';
......@@ -135,12 +135,12 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this._register(focusTracker.onDidBlur(() => this.keybindingsEditorContextKey.reset()));
}
setInput(input: KeybindingsEditorInput): TPromise<void> {
setInput(input: KeybindingsEditorInput, options: EditorOptions): TPromise<void> {
const oldInput = this.input;
return super.setInput(input)
.then(() => {
if (!input.matches(oldInput)) {
this.render();
this.render(options && options.preserveFocus);
}
});
}
......@@ -349,7 +349,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}));
}
private render(): TPromise<any> {
private render(preserveFocus?: boolean): TPromise<any> {
if (this.input) {
return this.input.resolve()
.then((keybindingsModel: KeybindingsEditorModel) => this.keybindingsEditorModel = keybindingsModel)
......@@ -360,7 +360,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}, {});
return this.keybindingsEditorModel.resolve(editorActionsLabels);
})
.then(() => this.renderKeybindingsEntries(false));
.then(() => this.renderKeybindingsEntries(false, preserveFocus));
}
return TPromise.as(null);
}
......@@ -370,7 +370,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.delayedFilterLogging.trigger(() => this.reportFilteringUsed(this.searchWidget.getValue()));
}
private renderKeybindingsEntries(reset: boolean): void {
private renderKeybindingsEntries(reset: boolean, preserveFocus?: boolean): void {
if (this.keybindingsEditorModel) {
const filter = this.searchWidget.getValue();
const keybindingsEntries: IKeybindingItemEntry[] = this.keybindingsEditorModel.fetch(filter, this.sortByPrecedence.checked);
......@@ -395,7 +395,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.unAssignedKeybindingItemToRevealAndFocus = null;
} else if (currentSelectedIndex !== -1 && currentSelectedIndex < this.listEntries.length) {
this.selectEntry(currentSelectedIndex);
} else if (this.editorService.getActiveEditor() === this) {
} else if (this.editorService.getActiveEditor() === this && !preserveFocus) {
this.focus();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册