Description
Describe the bug
The ▼ button on the right side of the editor bar lists all the editor tabs of the sketch. The user can select the tab from this menu, which can be useful for navigating sketches with many tabs.
🐛 If a sketch tab which has not previously been opened via the standard tab UI is opened from this menu, a duplicate tab is opened.
To Reproduce
- Select File > New from the Arduino IDE menus.
- Click the ▼ button on the right side of the editor bar.
- Select "New Tab" from the tab control menu.
- In the "Name for new file" field, type
TabB
. - Click the OK button.
- Save the sketch as "TabA".
- Close the IDE window that has "TabA" open.
(this is necessary because the bug only occurs when a tab has not yet been opened in the current window, and at this point both the tabs have been opened) - Open the "TabA" sketch in the Arduino IDE.
- Click the ▼ button on the right side of the editor bar.
- From the menu, select whichever of the two tabs is not currently open in the editor.
🐛 You now have two duplicate tabs for the file that was selected from the menu:
(in this screenshot, I selected "TabA.ino" from the menu)
Expected behavior
Each sketch file only ever gets a single tab in the editor.
Desktop
Original report
- OS: Windows 10
- Version: 2.0.0-rc3-snapshot.759b410
Date: 2022-01-31T13:15:29.574Z
CLI Version: 0.20.2 [13783819]
Last checked with
- OS: Windows 10
- Version: 2.0.0-rc3-snapshot-2f9bf86
Date: 2022-02-11T14:52:06.341Z
CLI Version: 0.21.0 [10107d24]
Additional context
This is most likely another incarnation of the same bug that causes #656. I decided to open a separate issue for it since this one is encountered via a significantly different and more common UI path than #656 and there have been multiple user reports of this general issue.
The duplicate tabs contain the file parent path as reported at #665
The issue is not dependent on the specific sketch creation method from the instructions. It will occur with any multi-tab sketch.