flirt.nvim icon indicating copy to clipboard operation
flirt.nvim copied to clipboard

Bug: flirt breaks some Telescope & Dressing windows, even when excluded

Open chrisgrieser opened this issue 2 years ago • 6 comments

In particular, for TelescopePrompt and DressingInput flirt does break functionality by hiding/obfuscating text in some (but not all) cases. Adding these to the list of excluded files does not seem to make a difference – both filetypes are not ignored, meaning the animations and the bugs persist.

Example for :Telescope git_branches with and without the plugin:

Pasted image 2023-07-31 at 22 14 11@2x Pasted image 2023-07-31 at 22 09 34@2x

Another plugin, whose window gets broken by flirt, is ccc, but here adding the respective filetype (ccc-ui) does seem to successfully ignoring the filetype.

chrisgrieser avatar Jul 31 '23 20:07 chrisgrieser

Heyyo @chrisgrieser,

Actually this is a known issue 😭 .

The thing is, telescope and others actually go like: buf_create() -> open_win() -> set_filetype()

Whereas it should have been: buf_create() -> set_filetype() -> open_win()

So there are 2 possible options to mitigate this as per my knowledge:

  1. I should make a contribution to these repos stating the obvious. Might be a tedious work and might break some of that plugins functionality.

  2. This is the cleanest way: Plugin maintainers exposing the zindex value of the float option. For example, if telescope exposed this option, i could set it in my telescope config (say something like value 69). Then in flirt I could filter that zindex value. (Or plugin maintainers can give the floats a custom fixed value which would make everything easier.)

This is from nvim_open_win()s doc:

• zindex: Stacking order. floats with higher `zindex` go on top on floats with lower indices. Must be larger
   than zero. The following screen elements have hard-coded z-indices:
    • 100: insert completion popupmenu
    • 200: message scrollback
    • 250: cmdline completion popupmenu (when
                wildoptions+=pum) The default value for floats are 50.
                In general, values below 100 are recommended, unless
                there is a good reason to overshadow builtin elements.

tamton-aquib avatar Aug 01 '23 04:08 tamton-aquib

Here is a telescope issue regarding zindices: https://github.com/nvim-telescope/telescope.nvim/issues/1926

@chrisgrieser , What do you think should be done? Or do you have a better idea? 🤔

tamton-aquib avatar Aug 01 '23 04:08 tamton-aquib

hmmm, yeah, that's tricky. I guess I would just attempt to suggest solutions at the respective plugin's repos, and see whichever the maintainers see as most fit for their situation?

otherwise, I am wondering whether there is something flirt can do to be usable for users even if a plugin defines its filetypes in that way. Could some sort of whitelisting floats instead of blacklisting be of help here maybe? 🤔

chrisgrieser avatar Aug 01 '23 06:08 chrisgrieser

suggest solutions at the respective plugin's repos, and see whichever the maintainers see as most fit for their situation?

Hmm yes it would be great if all plugins exposed this kind of option. In fact, the zindex option is the only option as of now that can differentiate different popups so it would make more sense if they fixed one for their floats.

Could some sort of whitelisting floats instead of blacklisting be of help here maybe?

I have thought about this before but it should be configurable by the user right? 🤔

tamton-aquib avatar Aug 01 '23 06:08 tamton-aquib

I have thought about this before but it should be configurable by the user right? 🤔

yeah. But since this plugin has the tendency to break things, it'd be to set a default whitelist where only plugins are added that have been confirmed to not break.

chrisgrieser avatar Aug 01 '23 07:08 chrisgrieser

But since this plugin has the tendency to break things, it'd be to set a default whitelist where only plugins are added that have been confirmed to not break.

Agreed 💯 .

But the thing is some floats (most) does not have some unique property (not even filetype). For example, diagnostic float, hover floats, also most plugins might open it in scratch mode so we cant differentiate them. That would mean we would only have a handful amount of plugins in the white list.

tamton-aquib avatar Aug 01 '23 09:08 tamton-aquib