Open
Description
Describe the problem
Arduino IDE incorrectly displays redundant editor tabs after the user renames a secondary sketch file under the following conditions:
- The sketch was opened in Arduino IDE at some point in time before the rename.
- The file system is case insensitive (Windows and macOS).
- The file was renamed using an external tool (e.g., file manager application,
mv
) - The new filename differs from the old one only in case.
🐛 The user will be confused by the presence of an editor tab for a file that no longer exists. They will not find any way to correct the situation via the Arduino IDE interface.
🐛 The bug can cause a loss of the user's sketch code.
To reproduce
- Select File > New Sketch from the Arduino IDE menus.
- Click the ▼ button on the right side of the editor toolbar.
- Select "New Tab" from the menu.
- In the "Name for new file" field, type
Foo.ino
- Click the OK button.
- Select File > Save As... from the Arduino IDE menus.
- Save the sketch to any convenient location.
- Select File > Close from the Arduino IDE menus.
- Use your file browser or terminal software to rename the file
Foo.ino
in the sketch folder tofoo.ino
. - Open the sketch in the Arduino IDE.
🐛 The editor still contains a "Foo.ino" tab in addition to the expected "foo.ino" tab. - Select File > Preferences from the Arduino IDE menus.
- Check the box next to "☐ Auto save".
- Click the OK button.
- Add some text to the "foo.ino" editor tab:
// hello world
- Select the "Foo.ino" editor tab.
😕 The editor does not contain the text that was added to the "foo.ino" editor tab. - Type a character in the "Foo.ino" editor tab.
🐛 An unexpected "The file 'Foo.ino' has been changed on the file system." dialog opens:
- Click the No button.
- Type a character in the "Foo.ino" editor tab.
- Click the Yes button in the dialog.
- Select the "foo.ino" editor tab.
🐛 The previous// hello world
contents of the file have been replaced by the characters that were added to the "Foo.ino" editor tab. - Select File > Preferences from the Arduino IDE menus.
- Uncheck the box next to "
☑
Auto save" - Click the OK button.
- Add some text to the "foo.ino" editor tab:
// foobar
- Select File > Save from the Arduino IDE menus.
🐛 An unexpected "The file 'Foo.ino' has been changed on the file system." dialog opens. - Click the Yes button.
🐛 An unexpected "The file 'foo.ino' has been changed on the file system." dialog opens. - Click the Yes button.
- Select the "foo.ino" editor tab.
😕 The editor does not contain the text that was added to the "Foo.ino" editor tab.
Expected behavior
Editor tabs always reflect the actual sketch files.
Arduino IDE version
Original report
2.0.0-beta.10
Last verified with
Operating system
- Windows
- macOS
Operating system version
- Windows 11
- macOS Ventura
Additional context
The bug does not apply to renaming using the editor tab control menu's "Rename" item because its dialog refuses to allow such a renaming (#2272).
Additional Reports
- Incorrect handling of changed case of sketch file name #482 (comment)
- https://forum.arduino.cc/t/file-delete-not-case-sensitive/1018207
Workaround
- Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
- Select the "View: Reset Workbench Layout" command from the menu.
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest nightly build
- My report contains all necessary details
Metadata
Metadata
Assignees
Labels
Related to content of the project itselfRelated to content of the project itselfPerceived defect in any part of projectPerceived defect in any part of project