Hacker News new | past | comments | ask | show | jobs | submit login

The reason I do the check that way is because if the user adds a character, and then deletes it, the buffer has not been modified, but if you just set a bool to true when an insert event happens, it will think the buffer has been modified.

If there is a better way to do this please let me know.




In general, you should optimize for common use cases. In a file editor, you will be modifying the file and when you go to save it, it will be different.

What do you gain by doing it this way?


What about setting the dirty bit with a boolean while you're working, but then before saving, do the diff to check if the file really needs saving?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: