goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.82k stars 109 forks source link

Bug: Highlight Ranges Don't Respect Using -1 #165

Closed flmng0 closed 1 year ago

flmng0 commented 1 year ago

When doing highlight ranges for an element, if the end is set to -1, it will fail if the text has any margin, or is centred.

After some investigation, I found that this is because left is always added to the end, in alpha.highlight.

It should be, if the end is -1, then it should be passed to the hl_tbl as -1

From here onwards, this issue becomes more of a feature request; it would be nice if -n was translated into #val - n for text types.

Would not be to hard to implement, I believe. I may even make a pull request later, unfortunately I'm not at a computer ATM though.

goolord commented 1 year ago

fixed in 7c72b03113fcd3dc5b53c3c0a29db307e178600a

goolord commented 1 year ago

From here onwards, this issue becomes more of a feature request; it would be nice if -n was translated into #val - n for text types.

implemented in d9e4a76ef7181b0303e26dc03a910cc14c934dcd -2 is 1 character from the end, -3 is 2, etc because "-1" is maintained as "to the end" by convention