Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Incorrect handling of changed case of sketch file name #482

Copy link
Copy link
Open
@DaveTur

Description

@DaveTur
Issue body actions

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

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Click the button on the right side of the editor toolbar.
  3. Select "New Tab" from the menu.
  4. In the "Name for new file" field, type Foo.ino
  5. Click the OK button.
  6. Select File > Save As... from the Arduino IDE menus.
  7. Save the sketch to any convenient location.
  8. Select File > Close from the Arduino IDE menus.
  9. Use your file browser or terminal software to rename the file Foo.ino in the sketch folder to foo.ino.
  10. Open the sketch in the Arduino IDE.
    🐛 The editor still contains a "Foo.ino" tab in addition to the expected "foo.ino" tab.
  11. Select File > Preferences from the Arduino IDE menus.
  12. Check the box next to "☐ Auto save".
  13. Click the OK button.
  14. Add some text to the "foo.ino" editor tab:
    // hello world
  15. Select the "Foo.ino" editor tab.
    😕 The editor does not contain the text that was added to the "foo.ino" editor tab.
  16. Type a character in the "Foo.ino" editor tab.
    🐛 An unexpected "The file 'Foo.ino' has been changed on the file system." dialog opens:
    image
  17. Click the No button.
  18. Type a character in the "Foo.ino" editor tab.
  19. Click the Yes button in the dialog.
  20. 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.
  21. Select File > Preferences from the Arduino IDE menus.
  22. Uncheck the box next to " Auto save"
  23. Click the OK button.
  24. Add some text to the "foo.ino" editor tab:
    // foobar
  25. Select File > Save from the Arduino IDE menus.
    🐛 An unexpected "The file 'Foo.ino' has been changed on the file system." dialog opens.
  26. Click the Yes button.
    🐛 An unexpected "The file 'foo.ino' has been changed on the file system." dialog opens.
  27. Click the Yes button.
  28. 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

69b7365

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

Workaround

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. 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

topic: codeRelated to content of the project itselfRelated to content of the project itselftype: imperfectionPerceived defect in any part of projectPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.