folke / dot

☕️ My Dot Files
Apache License 2.0
866 stars 52 forks source link

avoid statuscolumn layout shift #15

Closed jrnxf closed 1 year ago

jrnxf commented 1 year ago

Hey @folke!

Thanks again for your help on this reddit thread. I was able to get my statuscolumn just the way I wanted.

One thing I noticed while messing around with your snippet though, is that on some diagnostic errors (for sure if on the first line) you get a layout shift:

https://user-images.githubusercontent.com/21346716/214492610-a2639b3f-26bd-4215-b185-7febe7bf5425.mov

I was able to solve this by adding an extra space for when there isn't a diagnostic sign.

Cheers!

jrnxf commented 1 year ago

Actually I think it just totally depends on how you define your diagnostic signs. I'm using LazyVim and the default diagnostic signs have an extra space added to them here? Is this necessary?

Also, is there a recommended way to override these icons in LazyVim?

Edit: So it looks like for some reason the icon text that is returned from the get_signs method always has an extra space at the end of the icon (even for my gitsigns). Since that space doesn't appear necessary, I just remove the last char with :sub(1,-2) as you can see in my config. This fixes the layout shift and helps keep things as thin as possible

https://github.com/jrnxf/dot/blob/main/config/nvim/lua/util/status.lua

folke commented 1 year ago

It has something todo with multibyte characters. Not sure what the real solution is for this. In my config I don't get a shift since all signs are multi-byte.