Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Changing the encoding/line ending from the status bar menu doesn't update the template output #1

Open
eugenesvk opened this issue Oct 18, 2022 · 16 comments
Labels
bug Something isn't working

Comments

@eugenesvk
Copy link

eugenesvk commented Oct 18, 2022

This might be a limitation of the ST's API (see this bug) when losing focus to the status bar menu doesn't update the on_activate API, but maybe not and you know a way out :)

P.S. to be fair, this is a rather minor bug since people who use your plugin will likely replace the default status bar element and won't be able to change the encoding using it ;)

@jfcherng
Copy link
Member

jfcherng commented Oct 18, 2022

But how is this plugin affected?

The built-in line/column keeps stay in status bar when the view loses focus too.

@eugenesvk
Copy link
Author

eugenesvk commented Oct 18, 2022

No it doesn't, the native status works fine (and I'm talking about encoding/line ending, not line/column)

@eugenesvk eugenesvk changed the title Changing the encoding from the status bar menu doesn't update the template output Changing the line ending from the status bar menu doesn't update the template output Oct 18, 2022
@eugenesvk eugenesvk changed the title Changing the line ending from the status bar menu doesn't update the template output Changing the encoding/line ending from the status bar menu doesn't update the template output Oct 18, 2022
@jfcherng
Copy link
Member

Good point. Right now, the message only updates when on_activated and on_selection_modified indeed.

@jfcherng jfcherng added the bug Something isn't working label Oct 18, 2022
@jfcherng
Copy link
Member

Most likely fixed in 5f777f6 and release in v0.0.2.

@jfcherng
Copy link
Member

jfcherng commented Oct 18, 2022

The weird part is that if there are two (or more) consecutive line endings changes via the status bar. Only the first change will triggers the view settings listener callback. But still, better than never.

@eugenesvk
Copy link
Author

two (or more) consecutive line endings changes via the status bar. Only the first change will triggers

yeah, that's weird, tab size, though, doesn't have this weird bug

By the way, this seems to activate on every single keypress (even without on_selection_modified enabled), is that too much or no big deal (wish they just fixed their APIs so there is no need for these types of hacks)?

@jfcherng
Copy link
Member

jfcherng commented Oct 18, 2022

Well, line/column changes on every keypress , isn't it?

@eugenesvk
Copy link
Author

but the encoding/line ending don't change

@jfcherng
Copy link
Member

jfcherng commented Oct 18, 2022

so? since line/column changes, you have to update anyway. I would image encoding/line ending etc are all cached rather than heavily calculated in ST. I don't think you can notice the latency this plugin causes. Further optimizations are most likely meaningless at this moment but just make codes much more complicated.

@eugenesvk
Copy link
Author

since line/column changes, you have to update anyway

not really, maybe you're not using the line/column part of the template (either have it off or use the default shortened version), but only using the other indicators that don't update as often

Anyway, was just curious, hopefully it's all cached an all

@jfcherng
Copy link
Member

not really, maybe you're not using the line/column part of the template (either have it off or use the default shortened version), but only using the other indicators that don't update as often

Yes, we can let template variables update only when they change.

@jfcherng
Copy link
Member

The fix in 0.0.2 doesn't seem to work. I have no idea why it worked yesterday...

@jfcherng jfcherng reopened this Oct 19, 2022
@jfcherng
Copy link
Member

jfcherng commented Oct 19, 2022

It seems the fix introduce in 0.0.2 only works for files on filesystem, rather than unsaved buffer. I guess that's because LSP changes the view settings and thus triggers the view settings listenser.

@jfcherng
Copy link
Member

jfcherng commented Oct 19, 2022

Yes, we can let template variables update only when they change.

Done in 33aa1c8 and release 0.0.3.

@eugenesvk
Copy link
Author

I guess that's because LSP changes the view settings and thus triggers the view settings listenser.

BracketHighlighter is also heavy on storing its frequent changes in the settings, thus triggering the settings callback facelessuser/BracketHighlighter#431

@eugenesvk
Copy link
Author

Unfortunately, the ST folks closed my bug report with a weird take that losing input focus doesn't matter to the API that tracks losing input focus :(
So maybe there is no 100% certain way to track these changes...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants