CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

🐞 When the first tab is closed no tab is active

Open austincondiff opened this issue 2 years ago • 2 comments

Description

When the user closes the first tab and other tabs exist after it, no other tab is selected and editor area is empty.

To Reproduce

  1. Open three tabs.
  2. Click to select the left-most tab.
  3. Close this tab
  4. Notice that no tab is selected and editor area is empty.

Expected behavior

After closing the first tab, second (now first) tab should be selected.

Screen Recording

https://user-images.githubusercontent.com/806104/213084164-e4099941-e572-406d-b8ce-b1c8fab628cc.mov

austincondiff avatar Jan 18 '23 04:01 austincondiff

Documenting some of my sleuthing from discord, for posterity.

I'm looking at this tab closing issue... and noticing something worrying. when I breakpoint at the moment a tab is closed, I'm seeing that selectionState.openedTabs is showing a file that I have not opened at any point.

image
po selectionState.openedTabs
▿ 4 elements
  ▿ 0 : TabBarItemID
    - codeEditor : "/Users/XXX/projects/faceswap/.readthedocs.yml"
  ▿ 1 : TabBarItemID
    - codeEditor : "/Users/XXX/projects/faceswap/setup.py"
  ▿ 2 : TabBarItemID
    - codeEditor : "/Users/XXX/projects/faceswap/tools.py"
  ▿ 3 : TabBarItemID
    - codeEditor : "/Users/XXX/projects/faceswap/update_deps.py"

ben-p-commits avatar Jan 18 '23 20:01 ben-p-commits

It looks like CodeEdit is correctly saving the openedTabs array when saving the workspace state. However, the tab bar uses the getItemByTab(id: TabBarItemID) method to fetch tabs. This means that after closing and re-opening the workspace all files are closed but the tabs are marked as still open.

That also explains the original issue, there's a tab that's in the openedTabs array but isn't opened in the openFileItems array, so the tab bar doesn't display it when it becomes selected.

thecoolwinter avatar Feb 15 '23 17:02 thecoolwinter

@austincondiff are you able to recreate this on main branch?

https://user-images.githubusercontent.com/8212554/220164847-9e1abba5-6003-41ba-a6e7-b53850bac4bd.mp4

Code-DJ avatar Feb 20 '23 16:02 Code-DJ

@Code-DJ In the latest release, I am able to reproduce it.

https://user-images.githubusercontent.com/806104/220169804-7505096c-7c95-46ba-bbd3-71b332d8349b.mp4

Update: in main I am not able to reproduce.

austincondiff avatar Feb 20 '23 17:02 austincondiff

Closing, because we are not able to reproduce.

austincondiff avatar Jun 03 '23 15:06 austincondiff