Skip to content
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

Less save prompts #702

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Less save prompts #702

wants to merge 2 commits into from

Conversation

UrtsiSantsi
Copy link
Contributor

Currently there are 3 issues:

  1. Formatted text is set to the GtkSourceView buffer, even if it is the same, raising safe notification.
  2. UI XML is formatted is and set to the previously empty GtkSourceView buffer, even if the selected language is Blueprint.
  3. The .js and .css files don't have empty line at the end, but formatting them adds one.

This pull request solves the first 2 issues, but I'm not sure what to do with the last one - trim the empty line after formatting or add one to all the sources?

@sonnyp
Copy link
Contributor

sonnyp commented Oct 29, 2023

I agree it's annoying.

Right now for each session, we have a setting edited that defaults to false.
As soon as there is a change to one of the source view, it is set to true.

It's fine except that formatting or "Run" will set edited to true. We can fix that. GtkSourceView has a way to distinguish between user and non-user changes IIRC.


An other option is to store the name of the demo in the session and compare the content of the session with the content of the demo. It would be done here:

https://github.com/sonnyp/Workbench/blob/5486d703b050ca00d262a20dca03b480f9567617/src/window.js#L515

In which case we could create an "isEdited" function that would take care of it.


I'm not sure which one is best. The second option is probably easier / less maintenance effort.

If the demo was edited by Workbench between the time the user opened it and the user closed it – we will ask for confirmation, but I think that's fine, maybe even desirable.

TDLR: I'm not sure which approach is best, let me think about it and feel free to share your thoughts

@UrtsiSantsi
Copy link
Contributor Author

Now there is a save prompt for all the demos without even running them (except for Welcome).
This is Workbench 45.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants