SpartanJ / ecode

Lightweight multi-platform code editor designed for modern hardware with a focus on responsiveness and performance.
MIT License
938 stars 13 forks source link

Set Line Endings improvement #315

Closed ghost closed 2 months ago

ghost commented 2 months ago

I have a text file created by Geany on Linux that uses Linux line endings. I want to change it to use Windows line endings. I selected Windows line endings. But nothing happened. I realized I need to type something into the document, save it (and then delete the dummy text I have typed and save again), for it to actually change the line endings from Linux to Windows.

With Geany, when you select the new line endings, it will update the document immediately. I can understand the decision of ecode because Geany's behavior is bad for large text files. But instead of having me use the trick I described, ecode should ask me if I want to change to the new line endings and let me choose. It could be more clever, that is, only ask when the new line endings are different from the current ones.

SpartanJ commented 2 months ago

Makes sense, it should give some feedback to the user, i'll think about how to solve it. I don't like saving the file, and I don't like showing too many message boxes.

ghost commented 2 months ago

Makes sense, it should give some feedback to the user, i'll think about how to solve it. I don't like saving the file, and I don't like showing too many message boxes.

You could copy Geany's behavior. Geany updates the document immediately when you choose new line endings but it doesn't save the file. It marks the document as modified and let the user decided to save it or not. ecode can't handle even a 10mb json file (#311), so you could drop the consideration for performance when handling large text files.

SpartanJ commented 2 months ago

You could copy Geany's behavior. Geany updates the document immediately when you choose new line endings but it doesn't save the file. It marks the document as modified and let the user decided to save it or not.

I'll do that.

ecode can't handle even a 10mb json file (https://github.com/SpartanJ/ecode/issues/311), so you could drop the consideration for performance when handling large text files.

ecode can handle perfectly fine 10mb json files, what it does not handle gracefully is huge single line files, which aren't usually expected to be used for editing, so I don't care about it. Example, handling +25mb files, including a single line one. And I can't show you other editors because they take too long to even open and won't do highlighting (not even vscode). So I'm happy enough with current ecode's capabilities. I closed the issue because he didn't share the file and cannot reproduce. If you can reproduce the issue please share the file that triggers it for you.

https://github.com/user-attachments/assets/0cbb13ea-7548-495a-bcba-29715fae9678

Curculigo commented 2 months ago

@SpartanJ Try to stringify these JSONs and open them with ecode to see if ecode can handle it. My JSON file is indeed a bookmarks backup generated by Firefox. Imagine you have a bunch of obsolete domains that you want to use the editor's find and replace feature to replace with new domains. I don't think for such a simple task I need to use a real programming language. I don't care if this JSON has syntax highlighting or not.

Btw, I found this addon that solved my problem without having to use the JSON backup file:

https://addons.mozilla.org/en-US/firefox/addon/bookmark-url-batch-replacer/

SpartanJ commented 2 months ago

Yes, it does work for me. Without syntax highlighting it will work faster given that the most expensive task is disabled, that's why other editors do not even try to do syntax highlighting for those cases. If you have the crash log please share it.

There are a few things I can disable to improve the overall experience and I guess that's what you encountered:

  1. Disable matching brackets (finding matching brackets for huge files can be really really expensive).
  2. Disable creating the auto-complete dictionary, this is currently being limited by line count but not file size, i'll add that, because for single line examples is critical.
  3. Disable syntax highlighting for huge single line files.

You can try doing that manually, it might work / help.

SpartanJ commented 2 months ago

Done.