j-hui / j-hui/fidget.nvim

`override_vim_notify = true` -> notification captures cursor on `:q`

Open
#241 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Lua
Stars
2.6k
Forks
83
PR merge metrics
No merged PRs in 30d

Description

### Discussed in https://github.com/j-hui/fidget.nvim/discussions/218

> [!NOTE]
> *GitHub Discussions are now disabled for this project, so the above link will 404, but the relevant discussion with @mrcjkb is reproduced below.*

Originally posted by **mrcjkb** March 4, 2024
Hey :wave:

I really like fidget's `override_vim_notify` feature, as it usually doesn't get in my way, but I can look up notifications when I need them.

I've just been having one issue:
Sometimes, when trying to exit with `:q` or `:wq` while fidget is displaying a notification, instead of quitting Neovim, the cursor will move to the notification window.

I can consistently reproduce this with [neogit](https://github.com/NeogitOrg/neogit) (having the `disable_builtin_notifications` option set to `true` - which disables Neogit's notifications and uses `vim.notify` instead)

It always happens when I

- Modify something
- `:Neogit`
- `cc` to commit
- Type the commit message and `:wq` to commit
- `q` to close the Neogit tab - meanwhile the `Committed!` notification shows up in fidget.
- `:wq` -> cusor moves to the fidget notification floating window (if I hit `` before the notification window is closed).

Here's the weird part:

I cannot reproduce the behaviour if I manually trigger the notification that Neogit sends with

```lua
:lua vim.notify("Committed!", vim.log.levels.INFO, { title = "Neogit", icon = "󰊢" })
```

As I've only observed this behaviour with neogit notifications, I decided to put this in the Q&A.
It's probably not a fidget.nvim bug...


Response by **j-hui** March 18, 2024

Ah interesting, do you also get this error message?

```
"somefile" 3L, 11B written
E37: No write since last change
E162: No write since last change for buffer "[No Name]"
Press ENTER or type command to continue
```

I'm able to reproduce this issue, though am a little puzzled about what the cause might be. In particular, I'm not sure which buffer it is that was modified but has unsaved changes (the buffer for the Git-tracked `somefile` is clean).


Response by **mrcjkb** March 20, 2024

Yes, I think I was seeing similar error messages.


Response by **mrcjkb** March 21, 2024

Yep, I can confirm I am getting the same error message.
It's quite consistent with neogit, but I haven't observed it anywhere else.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Neogit sequence with `override_vim_notify = true`, then compare it with a direct `vim.notify("Committed!", ...)` call. Trace the notification handling and cursor behavior around `:q` and `:wq`; done means the repro no longer moves the cursor to the notification window or produces the reported unsaved-buffer errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.