rcarriga / nvim-notify

A fancy, configurable, notification manager for NeoVim
MIT License
2.97k stars 78 forks source link

"compact" rendering style has messed up highlight positioning #171

Closed runiq closed 1 year ago

runiq commented 1 year ago

When I display the output of :highlight commands with the "compact" render style, the positions of the highlights seem to be off by a lot:

image

Not sure what causes it, though.

rcarriga commented 1 year ago

I can't reproduce any issue with the highlighting, if you can provide a minimal init.lua then I can look into this further

mikesmithgh commented 1 year ago

I also have this issue. I'm on nvim nightly NVIM v0.9.0-dev-1079+g3f381f4d0-dirty in Kitty on OSX

I forked the lazy starter repo to reproduce the issue. https://github.com/mikesmithgh/starter/blob/nvim-notify-compact-issue-171/lua/plugins/nvim-notify.lua

You can execute the command:

docker run -w /root -it --rm alpine:edge sh -uelic '
  apk add git lazygit neovim ripgrep alpine-sdk --update
  git clone https://github.com/mikesmithgh/starter ~/.config/nvim
  cd ~/.config/nvim
  git checkout nvim-notify-compact-issue-171
  nvim
'

Then search for text that doesn't exist /asdf Screenshot 2023-02-28 at 10 40 24 AM

Please let me know if you need any additional information

runiq commented 1 year ago

@rcarriga Sorry, I've been getting sidetracked left and right. :( Can't provide a repro right now, I'll try tomorrow.

I'm also (kind of) using lazyvim, which uses noice.nvim with nvim-notify as a backend. I suspect the problem is somewhere in that chain, but if you can't reproduce, it's apparently not in nvim-notify.

mikesmithgh commented 1 year ago

@rcarriga Sorry, I've been getting sidetracked left and right. :( Can't provide a repro right now, I'll try tomorrow.

I'm also (kind of) using lazyvim, which uses noice.nvim with nvim-notify as a backend. I suspect the problem is somewhere in that chain, but if you can't reproduce, it's apparently not in nvim-notify.

Hey @runiq I was able to add the steps to reproduce that sound like very similar setup 👍

mikesmithgh commented 1 year ago

FYI this appears to be an issue in noice.nvim, I opened a draft PR: https://github.com/folke/noice.nvim/pull/375

folke commented 1 year ago

This has been fixed in the meantime in Noice. See here

Some additional context:

Noice overrides the nvim-notify renderer so we can also add highlights to the messages themselves. Things coming in though nvim_echo for example have styling for the message body, so noice makes sure those styles also get applied correctly when displayed in nvim-notify.

The compact renderer is pretty new and different from the other ones in that it prefixes the first line of the body with the title. Noice didn't take col offsets into account. This has now been fixed.

runiq commented 1 year ago

Hey, thanks all for putting in the work, and sorry I couldn't be of more help. I'll try to do better next time!

rcarriga commented 1 year ago

Great to see a resolution :smile: Thanks @folke for the info and @mikesmithgh for the reproduction!