SmiteshP / nvim-navbuddy

A simple popup display that provides breadcrumbs feature using LSP server
Apache License 2.0
770 stars 30 forks source link

feat: Add markers for node type #42

Closed aaronkollasch closed 1 year ago

aaronkollasch commented 1 year ago

This PR adds markers that distinguish leaf/terminal nodes from branch/internal nodes. The markers can be enabled/disabled and their icons changed in a new node_markers config section.

It also removes an extra column of whitespace on the right borders of the left and middle popup panes.

Screenshots

Selecting a branch node:

Screenshot 2023-04-09 at 11 30 06 AM
Showing a preview of a leaf node:

Screenshot 2023-04-09 at 11 28 26 AM

Alternate: with space after branch node marker. This takes more space, but the markers are better aligned:

Screenshot 2023-04-09 at 11 24 07 AM

Disabling node markers works as expected (also the selected cursorline on the left and middle panels now extends to the panel border):

Screenshot 2023-04-09 at 11 42 35 AM

SmiteshP commented 1 year ago

Hey wow! Very cool man! I was actually trying to implement something like this but by adding spaces till the end, was facing issues in that approach while calculating string length. Because unicode character count as four characters. But using virtual text is brilliant idea!!

aaronkollasch commented 1 year ago

Thanks! The one drawback is that the virtual text can cut off the last two characters of a label, such as display:focus_rang in the example. I tried setting wraplines for to the window width minus some number but it didn't seem to work. Since it's only two columns, I don't think it's a huge issue. What do you think?

SmiteshP commented 1 year ago

Tried them out, noticed that when the text is exactly as long as the window width, a few characters get hidden under the virtual text. Its not a big issue in my opinion anyways.