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

After quitting diff window, BufEnter event cannot be triggered #470

Closed
rockyzhang24 opened this issue Feb 7, 2022 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@rockyzhang24
Copy link
Contributor

rockyzhang24 commented Feb 7, 2022

Description

After using :q to quit the window created by :Gitsigns diffthis, the cursor goes back to the original buffer, however, BufEnter event cannot not be trigger.

Is this a bug? Thank you very much.

Neovim version

NVIM v0.7.0-dev+975-g4a96e7809

Operating system and version

macOS 12.2 (the latest)

Steps to reproduce

  1. In init.vim, create an autocmd for demo:

    autocmd BufEnter * echom "Hello"
    
  2. Then in any buffer, run :Gitsigns diffthis. A temp split window will be opened and the cursor is positioned in this temp window.

  3. Run :q to quit the diff mode. The temp split window will be closed and the cursor goes back to the original window (buffer), however, "Hello" doesn't show in :messages, i.e., BufEnter event is not triggered.

Expected behavior

BufEnter event should be triggered after quitting the diff window.

Actual behavior

See above

Gitsigns debug messages

No response

Minimal config

Using gitsigns default config.

@rockyzhang24 rockyzhang24 added the bug Something isn't working label Feb 7, 2022
@rockyzhang24
Copy link
Contributor Author

@lewis6991 Any ideas please? I am customizing my setup and this "issue" confuses me a lot. Thank you so much.

@lewis6991
Copy link
Owner

I've been able to reproduce the issue but have no idea why it occurs. My guess is that it is a quick of Neovim.

@rockyzhang24
Copy link
Contributor Author

Many thanks. Does it mean this is a bug of Neovim? Because I don't know how you implement diffthis() internally, could you please open an issue in Neovim repo for me? Thank you very much.

@lewis6991
Copy link
Owner

It's just a guess, but it could be. Might even be intended behaviour.

I'll look into it at some point.

@rockyzhang24
Copy link
Contributor Author

Okay. Thank you.

@rockyzhang24
Copy link
Contributor Author

rockyzhang24 commented Feb 10, 2022

Hi @lewis6991 ,
One hint here: If I use :Gdiffsplit command of fugitive.vim to perform the same steps, no more issues, i.e., BufEnter event can be triggered as expected. Both :Gdiffsplit and diffthis() open the same diff split windows, but I have no idea on the difference of their internal implementations. Probably you could dig into it to figure this out.

Thank you.

@rockyzhang24
Copy link
Contributor Author

Nice! Thanks.

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