From 23bee2320947c4ba2074fc3f2c1b43f1709ad85a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 6 Dec 2017 12:03:02 +0100 Subject: [PATCH] fix #39780 --- .../parts/preferences/browser/keybindingsEditor.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts index aef11baaa87..46c2facbeaa 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts @@ -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 { + setInput(input: KeybindingsEditorInput, options: EditorOptions): TPromise { 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 { + private render(preserveFocus?: boolean): TPromise { 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(); } } -- GitLab