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

Conflict with nvim-notify #24

Closed
YuCao16 opened this issue Aug 2, 2022 · 8 comments
Closed

Conflict with nvim-notify #24

YuCao16 opened this issue Aug 2, 2022 · 8 comments

Comments

@YuCao16
Copy link

YuCao16 commented Aug 2, 2022

Hi,

I hope someone is still maintaining this plugin. I found that nvim-peekup would conflict with nvim-notify, as shown below:
iShot_2022-08-02_23 29 02
Because nvim-notify will create a popup window, and seems nvim-peekup redraw the content but not the border:
iShot_2022-08-02_23 29 19
I tried to fix by myself, but I'm just too unfamiliar with Lua, hope someone will help, thanks!

@gennaro-tedesco
Copy link
Owner

gennaro-tedesco commented Aug 3, 2022

Good morning and thank you for bringing this to attention! I am not familiar with nvim-notify: in what context are you getting the screenshot situation where you have two windows that are mismatching? Is this whenever nvim-peekup is opened or only under certain circumstances?

In nvim-peekup the screen is re-drawn after keypress, in particular you can check the underlying code here:

vim.cmd('redraw')
To give some explanation/context: in general it may happen that this plethora of plugins that we have nowadays have been developed independently (as Neovim progressed shipping new features) without worrying too much about mutual integration (it happens with some other plugins out there too): this is also due to the fact that since the beginning, there has not been a unique way or unique API to draw pop-up windows (that was initially, strangely enough, a Vim-only feature, not Neovim), thus the independent maintainers came up with their own way to manage floating windows that may conflict with each other.

I plan to re-factor the whole codebase and release a new version of this plugin once Neovim 0.1.0 ships, namely when a standard API for floating object is agreed upon and made more or less the standard (otherwise I will have to change it whenever a new 0.0.X release is published), and all plugins convert to that.

Meanwhile coming back to your problem: could you try to fork this repository and create a version removing the redraw (from the code lines I linked above) and see if it still conflicts with nvim-notify?

@YuCao16
Copy link
Author

YuCao16 commented Aug 3, 2022

Good morning @gennaro-tedesco , it seems we are in the same time zone.

In my own understanding, and I'm not familiar with nvim-notify, it's just a dependency, nvim-notify provides an api that allows other plugins to use it to pop up a notification.

This bug occurs when a peek window exists and then a notify window pops up. If no popup appears it works all good. It looks like it's because a popup appears to make peekup.nvim redraw the content, but I removed vim.cmd("redraw") and the problem still. And I also tried to remove another vim.cmd("redraw") and then both of them, but still no luck.

@gennaro-tedesco
Copy link
Owner

So, if I understand correctly:

  • normal invokation: nvim-peekup works fine
  • nvim-peekup window invoked, then nvim-notify notification pops up ---> peekup window is being shifted due to redraw

if this is the case (please correct my understanding if wrong) I would say this is due to the fact that nvim-notify does not check for previous hanging windows before taking action (how can peekup know that at some point some other notifications will pop-up and force redraw the screen?).

@YuCao16
Copy link
Author

YuCao16 commented Aug 3, 2022

Yes, that's what I meant. I think it's a problem with the neovim plugin ecology that there isn't a uniform and well established rule to prevent this from happening.

I was just wondering if there was an easier way to fix it, like redraw, I'm not sure why it doesn't work.

@gennaro-tedesco
Copy link
Owner

I share your sentiment that the current plugin ecology is not uniform. Recently there has been a similar discussion thread on reddit and as you can see from the comments, many people lament the conflicting defaults or plugins stopping working when others are invoked.

there isn't a uniform and well established rule to prevent this from happening.

This is because until we reach a stable Neovim version 1.0.0, features and API rules are being changed constantly and people develop according to what is there at that point in time.

I will have a look at the code of nvim-notify later, hopefully we could find a quick fix - but if not I would suspect for the time being we just have to live with these conflicting changes.

@gennaro-tedesco
Copy link
Owner

gennaro-tedesco commented Sep 14, 2022

@YuCao16 I have released a new version of the plugin (see v0.1.0 ) where I have improved the behaviour of the window on lose focus and window change (in particular now the border follows the newest Neovim api, so it should be redrawn together with the window). Now at any window change the peekup window should close automatically and this should avoid any conflict with notify, ideally.

Please update the plugin (PlugUpdate) and see if the problem persists.

@YuCao16
Copy link
Author

YuCao16 commented Sep 14, 2022

@YuCao16 I have released a new version of the plugin (see v0.1.0 ) where I have improved the behaviour of the window on lose focus and window change (in particular now the border follows the newest Neovim api, so it should be redrawn together with the window). Now at any window change the peekup window should close automatically and this should avoid any conflict with notify, ideally.

Please update the plugin (PlugUpdate) and see if the problem persists.

Thank you very much for your efforts, I have tried the latest version and everything seems to be fine. But I can no longer reproduce the previous bugs because I have switched from coc to the built-in lsp.

@gennaro-tedesco
Copy link
Owner

I will then close the issue. Feel free to open another one if new unexpected behaviours shall occur.

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

2 participants