-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two tabs open for same file and won't close #1791
Comments
I have a similar issue, but I can't recall having dealt with libraries. |
Thanks for your reports. Unfortunately, I have not been able to reproduce this fault via use patterns resembling those described here and in the associated reports. I am aware of two use patterns that will result in a duplicate tabs fault: Renaming a sketch file in a manner that only changes the case of the filenameTracked at #482 I'm certain that bug is unrelated to the one reported here for the following reasons
Opening sketch in a very old version of Arduino IDE 2.x
🐛 The editor will contain duplicate sketch tabs for the sketch you opened previously. However, I'm not convinced this is the cause of the faults reported here. The reasons:
WorkaroundThe following procedure restores a sketch which is exhibiting the duplicate tabs fault as produced by either of the procedures described above:
Since I am not able to reproduce the fault via normal usage of Arduino IDE as reported in this issue, I was unable to verify this workaround works under those conditions. |
I am seeing something similar with 'arduino-ide_nightly-20230104_macOS_64bit.dmg' on macOS Monterey: Selecting certain file tabs duplicates that tab. This behavior has been around earliest Arduino IDE v2.x revisions I've used. I can delete either of the duplicates by clicking its 'x' in the Open Editors list, but only if the Open Editors list had been open when the duplicate was created. If the list wasn't open and I open it after the duplicate tab is created, the duplicate tab doesn't appear in the list and I can't delete it. My code files consist of an .ino file, two .h files, and three .cpp files. Tab duplication seems to happen consistently with two of the .cpp files but not with any of the other four files. The three .cpp files are very similar to one another, having been written from the same template. The first check-in of the .ino file was March 9, 2014; the project has been through nearly 9 years of Arduino IDE versions (plus Gnu Emacs used about equally). There are non-code files in the same directory as well: I don't know what, if any, of the above details will be of any help, but I hope something will. |
I repeatedly had the problem where the sketch file would be open in two tabs. I suspect the problem is the sketch file was stored in a file path that was about 165 chars long. The IDE may not allow for path strings to be that long. I moved the sketch folder for this sketch file to another location, and the file now opens up in a single tab. |
Thanks for sharing this information @GaryInSanDiego! I just checked with a sketch in a path 247 characters long and unfortunately still couldn't reproduce the fault.
An alternative explanation for this is that Arduino IDE stores data about the UI state associated with a given sketch project separately from the sketch files. That data is keyed to the sketch path. So if the bad duplicate tabs state is stored for the sketch at one path, when you move the sketch, you also disassociate it from that previous data and the IDE instead creates a new data entry for the project at that new location. |
I agree the length of the path is not the cause of the problem. The two tab problem appears to be fixed by moving the sketch folder to another folder. After moving the folder, I opened Arduino IDE ver 2.0.3, and it opened with two new blank sketches with todays date (ie. sketch_feb2a.ino just like that pictured above). I then opened the sketch file that I just moved, and it opened in a single tab. The sketch file that I was working with was developed in Oct of 2021, and since then I have uninstalled and reinstalled both versions of the Arduino IDE (versions 1.8.57.0 and 2.0.3). I think they are now installed in C:\Program Files\WindowsApps on my Windows 10 computer. |
I can reproduce the two tabs problem with an old sketch file called RGB_LED.ino (in the ELEGOO starter kit). I compiled this using Arduino IDE version 1.* back on 8/20/2021. Yesterday, I opened this RGB_LED.ino sketch using Arduino IDE version 2.0.3, and the IDE displays two tabs for the same sketch file. I clicked File/Save As, and saved the sketch to another directory with the name myRGB_LED.ino. The two tab problem persisted in this newly saved version. I closed the IDE and used Windows 10 File Explorer to copy this sketch file to another folder. I opened this copied sketch file using Arduino IDE 2.0.3 and only one tab was displayed for the sketch file. I then used the File/Save As feature to save this sketch to a new name called myRGB_LED_ver2. The problem of having two tabs for the same sketch file came back.
I suspect this may have something to do with the IDE editor remembering selected text positions in the sketch file. If there are two tabs, it remembers selected text in both tabs. I have not found where the IDE editor stores the editing info yet. I did look at the folders/files in C:\Users\Name\AppData\Local\Temp and saw several folders for Arduino. I noticed when I compile a sketch, a sketch folder is produced in this Temp folder (with several sub-folders), which shows paths and file names. |
I've found the following (seemingly) solid workaround. If the main sketch file (let's call it A.ino in directory A) shows with a duplicate tab, the following steps remove the duplicate tab
The duplicate tab for A.ino has disappeared.
After removing B.ino and reseting the workbench layout again, the duplicate tab for A.ino does not appear again. Posting to provide a workaround as well as that it might be a pointer for developers to the underlaying issue. It's the second time that I used this approach. The first time I was not sure what I exactly did (except for creating the additional ino file). Note: //Edit |
Any progress on this bug? I tried all of the above and am still getting a duplicate of an example sketch. I am using win7 and the IDE version 2.0.4. |
to avoid duplicate editor tabs when opening a sketch with no previously saved workbench layout Closes #1791 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
the smaller the timeout the better chance you have to see the duplicate editors. Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
to avoid duplicate editor tabs when opening a sketch with no previously saved workbench layout Closes #1791 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
There is a PR with the proposed fix. I could not reproduce the bug on my env, but I found the problem and fixed it. Could somebody help verify the change? The PR is #1969, and the documentation on how to help with the beta build is here https://github.com/arduino/arduino-ide/blob/main/docs/contributor-guide/beta-testing.md. Thank you! |
to avoid duplicate editor tabs when opening a sketch with no previously saved workbench layout Closes #1791 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Describe the problem
I included a library via the menu and somehow this resulted in another tab opening for the same file. When I try to delete the file nothing happens. I've tried to move the sketch to some other folder and then open and that seems to work (after it renames the parent folder), but when I move it back to the original folder the new tab reappears.
I'm on Ubuntu 22.04.1 LTS and the latest stable version of the IDE shown on the website at the time of writing (2.0.3). I also tested on the latest nightly and it occurs there too.
If you need log files or something, please let me know.
To reproduce
I tried reproducing and couldn't. But the issue is still there, even when I open the project on the nightly build.
Expected behavior
Delete closes the tab. Or closing and reopening the ediitor...
Arduino IDE version
2.04-nightly-20221229
Operating system
Linux
Operating system version
22.04.1 LTS
Additional context
The fact that this occurs across builds and after moving things around makes me think this has something to do with some kind of cache or (sketch?) settings file somewhere, but I don't know for sure.
I also remember the save icon being on briefly. I have autosave on, so I'm not sure if this happened before or after the library was included.
Additional reports:
Related:
Issue checklist
The text was updated successfully, but these errors were encountered: