Skip to content

Commit 68b2a66

Browse files
author
Benjamin Pasero
committed
editor - only set pinned on replaceEditor() if not specified already (fix microsoft#87212)
1 parent 1fac56e commit 68b2a66

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/vs/workbench/browser/parts/editor/editorGroupView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
835835
// Determine options
836836
const openEditorOptions: IEditorOpenOptions = {
837837
index: options ? options.index : undefined,
838-
pinned: !this.accessor.partOptions.enablePreview || editor.isDirty() || options?.pinned || typeof options?.index === 'number',
838+
pinned: !this.accessor.partOptions.enablePreview || editor.isDirty() || (options?.pinned ?? typeof options?.index === 'number'), // unless specified, prefer to pin when opening with index
839839
active: this._group.count === 0 || !options || !options.inactive
840840
};
841841

@@ -1497,7 +1497,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
14971497
}
14981498

14991499
options.inactive = !isActiveEditor;
1500-
options.pinned = true;
1500+
options.pinned = options.pinned ?? true; // unless specified, prefer to pin upon replace
15011501

15021502
const editorToReplace = { editor, replacement, options };
15031503
if (isActiveEditor) {

src/vs/workbench/browser/parts/editor/textDiffEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
175175
// because we are triggering another openEditor() call
176176
// and do not control the initial intent that resulted
177177
// in us now opening as binary.
178-
const preservingOptions: IEditorOptions = { activation: EditorActivation.PRESERVE };
178+
const preservingOptions: IEditorOptions = { activation: EditorActivation.PRESERVE, pinned: this.group?.isPinned(input) };
179179
if (options) {
180180
options.overwrite(preservingOptions);
181181
} else {

0 commit comments

Comments
 (0)