Fix change of focused tab after a tab is closed (#1480)

Fix #986
This commit is contained in:
gautamv95
2020-02-29 19:06:47 +05:30
committed by GitHub
parent 6155606d20
commit 11b660e05d

View File

@@ -113,12 +113,15 @@ export const closeEditorTab = (
state: EditorTabsState,
chosenEditorTab: EditorTab
): EditorTabsState => {
const chosenEditorTabId = state.editors.indexOf(chosenEditorTab);
return changeCurrentTab(
{
...state,
editors: state.editors.filter(editorTab => editorTab !== chosenEditorTab),
},
state.currentTab
chosenEditorTabId >= state.currentTab
? state.currentTab
: state.currentTab - 1
);
};