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

Autosave bug #279

Open
ravaq opened this issue Aug 15, 2023 · 8 comments
Open

Autosave bug #279

ravaq opened this issue Aug 15, 2023 · 8 comments

Comments

@ravaq
Copy link
Contributor

ravaq commented Aug 15, 2023

Hi
(should I post this here or in the plugins page?)

  1. for me, 'autosaveonfocuslost' plugin doesn't work.
  2. 'autosave' plugin works, but if change focus before autosaving, it doesn't autosave anymore until another change in the code, even after refocus on tab.
@Guldoman
Copy link
Member

Hi (should I post this here or in the plugins page?)

Yep, makes more sense for this to be there. I'll transfer this.

  1. for me, 'autosaveonfocuslost' plugin doesn't work.
  2. 'autosave' plugin works, but if change focus before autosaving, it doesn't autosave anymore until another change in the code, even after refocus on tab.

I'll give a look.

@Guldoman Guldoman transferred this issue from lite-xl/lite-xl Aug 15, 2023
@Guldoman
Copy link
Member

  1. for me, 'autosaveonfocuslost' plugin doesn't work.

Mmm, seems to work for me. What are your steps?
Keep in mind that it's only saving the currently open and visible document. We could make it save everything tho.

  1. 'autosave' plugin works, but if change focus before autosaving, it doesn't autosave anymore until another change in the code, even after refocus on tab.

This plugin is a bit weird as it simply runs the save command (as if you were pressing ctrl+s, so targeted to the currently opened and visible file) after a timeout from the last change in any opened doc.
So if you change tab before the timeout, it'll save the new selected tab.
Yeah, we need to make this one more robust too...

For the focus issue with autosave, this is an issue of Lite XL, as we try not to run anything while we're not in focus. We have a couple of ideas to remedy that, but the issue is still there.

@ravaq
Copy link
Contributor Author

ravaq commented Aug 16, 2023

Thanks

  1. I don't understand, do you mean my steps for unfocusing the tab? just by changing the tab or clicking on the left pane items and so on.
  2. The problem is that even when the tab returns to focus, the autosave doesn't work until the next change, as if it forgot that the tab remained unsaved. perhaps each tab could have some 'unsaved flag' so that the autosave plugin saves tabs with this flag when focus is lost or refocused or the app is closed.
    And it would have been better to have the option to save unsaved tabs when closing the tab or application, instead of the confirmation dialog for closing unsaved tabs.

@Guldoman
Copy link
Member

  1. I don't understand, do you mean my steps for unfocusing the tab? just by changing the tab or clicking on the left pane items and so on.

The focus the plugin works on, is the window focus, not the tab focus.
I guess it could be improved to handle that too...

  1. The problem is that even when the tab returns to focus, the autosave doesn't work until the next change, as if it forgot that the tab remained unsaved. perhaps each tab could have some 'unsaved flag' so that the autosave plugin saves tabs with this flag when focus is lost or refocused or the app is closed.

It's because the save command was sent to the tab that was selected when the timeout expired. So yeah, it's just that the plugin should keep track of which doc to save.

And it would have been better to have the option to save unsaved tabs when closing the tab or application, instead of the confirmation dialog for closing unsaved tabs.

Yeah I guess that could be improved. If you open an issue about it in the main repo, we'll keep track of that.

@ravaq
Copy link
Contributor Author

ravaq commented Aug 17, 2023

The focus the plugin works on, is the window focus, not the tab focus.
I guess it could be improved to handle that too...

ok, sorry, I misunderstood, and it's clear in the plugin description.

Yeah I guess that could be improved. If you open an issue about it in the main repo, we'll keep track of that.

thanks again, and can you re-transfer it? :)

@Guldoman
Copy link
Member

ok, sorry, I misunderstood, and it's clear in the plugin description.

No worries. The idea of saving on tab change could be implemented too.

Yeah I guess that could be improved. If you open an issue about it in the main repo, we'll keep track of that.

thanks again, and can you re-transfer it? :)

Might be better to create a new issue about it to avoid confusion, and to keep this here as a feature request about autosaveonfocuslost as well as bug report about autosave.

@BartolomeyKant
Copy link

Hi.
autosaveonfocuslost doesn't work for me, even if I change window focus.

I'm running on Hyprland wm.

@Guldoman
Copy link
Member

It's possible that Hyprland doesn't let the window know that it lost focus.
Try running Lite XL in full Wayland mode like this: SDL_VIDEODRIVER=wayland lite-xl.

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

No branches or pull requests

3 participants