grapp-dev / nui-components.nvim

A feature-rich and highly customizable library for creating user interfaces in Neovim.
https://nui-components.grapp.dev
MIT License
303 stars 6 forks source link

bug: `Tree` component does not properly set CursorLine highlight to line in window #40

Closed vague2k closed 4 months ago

vague2k commented 4 months ago

Hello! It seems like line highlighting does not work as intended when using a Tree or Tree like component such as select. I do not get CursorLine highlighting when hovering over.

Although I will say that a highlight does get applied in the component when layout is first rendered, but when it's focused the highlight gets cleared. This seems to be unexpected behavior. I will provide some screenshots below

Here is what the layout looks like on initial render.

Screenshot 2024-04-27 at 3 50 29 PM

This is what the Tree component looks like when focusing the Tree component, notice there's no CursorLine highlighting. I have made sure the theme has a CursorLine highlight as seen from the screenshot.

Screenshot 2024-04-27 at 3 52 48 PM

While I think this is unexpected behavior, If there's some context I'm missing please let me know so I can close the issue! I also apologize for the rather obnoxious screenshots

mobily commented 4 months ago

@vague2k have you tried using the NuiComponentsTreeNodeFocused highlight group instead? (see: https://nui-components.grapp.dev/docs/components/tree#highlight-groups)

vague2k commented 4 months ago

Yes I have, and it does work, but in every example of the components being used that I've found from the showcase section the highlighting seems to be part of the component?

mobily commented 4 months ago

it's not part of the component implementation, you have to define highlight groups on your own, for instance, in the plugin config, as components don't define any by default