coteditor / CotEditor

Lightweight Plain-Text Editor for macOS
https://coteditor.com
Other
6.21k stars 425 forks source link

CotEditor doesn't properly edit files on drives without permanent version storage. (CircuitPython) #1192

Open Zenith222 opened 2 years ago

Zenith222 commented 2 years ago

In case you're unfamiliar, Circuit Python is a fork of Micro Python that takes advantage of native USB on some microcontrollers to create a USB mass storage device. Inside this mass storage device, the Python files are stored.

This sounds very convenient, but it also causes some compatibility issues with text editors. Adafruit recommends text editors that write full files on save, to ensure the files are not corrupted as the files are saved. When the files are updated the microcontroller automatically resets to run any code changes.

There's also another important consideration. Circuit Python drives are typically very small in size, usually ranging from hundreds of KB to a few MB. Because of this, Circuit Python drives block file history features of macOS.

This causes multiple problems with CotEditor. Opening a file in CotEditor works. Saving a file in CotEditor simply results in an error that it cannot be saved. Additionally, the autosave features of CotEditor causes the microcontroller to reset occasionally as CotEditor tries to write to the drive. Even when disabling the version history and autosave features the files cannot be saved. Upon exit, it gives another error that it could not be autosaved.

I'm wondering if there's any way to support a mode of pure text editing. Without the nifty autosave and file history. Don't get me wrong, I absolutely love these features. But I wish there was a way to get pure text editing with instant writes as soon as I click save, only when editing the Circuit Python files.

I love CotEditor. It's beautiful, light, and useful. Is there any way to fix this?

https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code

Update: An app called Textastic works fine in this exact use-case. It can save the files. It also keeps version history during a session. (not storing it permanently) I have no clue how, but it works. It is possible. I wish CotEditor did this. Because I like it much more.

Update: If any developers would like a platform to test this on, a $4 Raspberry Pi Pico is likely available worldwide. It runs CircuitPython.

Ryan5453 commented 2 years ago

I'm having sort of the same issue - but it's simply a Samsung USB C Flash Drive.

CotEditor or TextEdit can both open the file but neither can save. Visual Studio Code works fine though.