Skip to content

Selecting sketch tab via menu results in duplicate tabs #793

@per1234

Description

@per1234

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

  1. Select File > New from the Arduino IDE menus.
  2. Click the button on the right side of the editor bar.
  3. Select "New Tab" from the tab control menu.
  4. In the "Name for new file" field, type TabB.
  5. Click the OK button.
  6. Save the sketch as "TabA".
  7. 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)
  8. Open the "TabA" sketch in the Arduino IDE.
  9. Click the button on the right side of the editor bar.
  10. 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:

image

(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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions