goolord / alpha-nvim

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

Utf8 header not center #1

Closed Nguyen-Hoang-Nam closed 3 years ago

Nguyen-Hoang-Nam commented 3 years ago

Your function longest_line failed in uft8, I suggest create a function to count utf8 length similar to this

utf8

goolord commented 3 years ago

i just pushed a commit that should fix this

https://github.com/goolord/alpha-nvim/commit/97ef0679ebd4a2cba171f1f32a4612bbc355c0c0#diff-ec96159a0e4ab00d2629897381414ffd88f8e88aa0b82e2f8ba6e24da2873239R15-R25

i decided to use vim.fn.strdisplaywidth because

  1. should be accurate
  2. don't have to write it myself
  3. i don't really know the performance characteristics, but it shouldn't be too big an overhead since longest_line gets memoized

testing it on my machine this seemed to fix the problem !

thank you for helping me uncover this lua jank