-
Notifications
You must be signed in to change notification settings - Fork 21
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
Ask to save the file before closing the tab #280
Comments
Ok i tried working on this, but cant quite figure out how to check if the file contents have been changed or not ( So we can show the save dialog). @billyeatcookies |
@vyshnav-vinod thanks for working on the issue! I think a good approach would be to calculate the initial hash of file when it was opened and then store it, then on next save/close, recalculate hash for content in editor and try to match it with initial. def calculate_hash(self):
content = self.get("1.0", "end-1c")
return hashlib.md5(content.encode()).hexdigest() If the hashes are equal, that means there are no changes. Otherwise if they mismatch, show the dialog. And if the user accepts on saving, then we can set initial hash to be the newly calculated one. Comparing the giant strings is the only way i see here. And using Try to make a function on GUIManager level too that is bound to whole app destroyed event. self.protocol("WM_DELETE_WINDOW", self.on_close) And trigger the editor level function to show dialog (only if |
Remove unnecessary comments
Feature
When the user closes the tab, it would be helpful if biscuit asked to save the file. It would be also good to maybe find a way to show if a file has been saved or not. Like in VScode, if the file is not saved, there will be a white circle instead of the close sign in the tab.
The text was updated successfully, but these errors were encountered: