Open recently closed tab auto pins it when the other group has a pinned tab (fix #132833)

上级 b653e2a7
......@@ -762,21 +762,16 @@ export class HistoryService extends Disposable implements IHistoryService {
}
private async doReopenLastClosedEditor(lastClosedEditor: IRecentlyClosedEditor): Promise<void> {
// Determine editor options
let options: IEditorOptions;
if (lastClosedEditor.sticky) {
// Sticky: in case the target index is outside of the range of
// sticky editors, we make sure to not provide the index as
// option. Otherwise the index will cause the sticky flag to
// be ignored.
if (!this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index)) {
options = { pinned: true, sticky: true, ignoreError: true };
} else {
options = { pinned: true, sticky: true, index: lastClosedEditor.index, ignoreError: true };
}
} else {
options = { pinned: true, index: lastClosedEditor.index, ignoreError: true };
const options: IEditorOptions = { pinned: true, sticky: lastClosedEditor.sticky, index: lastClosedEditor.index, ignoreError: true };
// Special sticky handling: remove the index property from options
// if that would result in sticky state to not preserve or apply
// wrongly.
if (
(lastClosedEditor.sticky && !this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index)) ||
(!lastClosedEditor.sticky && this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index))
) {
options.index = undefined;
}
// Re-open editor unless already opened
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册