foss-haas / vsc-fontsize-shortcuts

Visual Studio Code extension to change the font size with keyboard shortcuts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User setting "editor.fontSize" can be a decimal but "fontshortcuts.step" cannot

simeyla opened this issue · comments

I really want to be able to zoom in 0.5 of a font size at a time.

When I use 0.5 for fontshortcuts.step it rounds up to the next whole pixel size.

{
    "window.zoomLevel": 0,
    "editor.mouseWheelZoom": true,
    "editor.lineHeight": 0,
    "editor.fontSize": 13.5,
    "fontshortcuts.step": 0.5
}

When I enter manually a fontsize of 13.5 it is halfway between 13 and 14, so decimals are supported.
This would be very useful. I have a large 4k screen and each half point size is quite a big difference.

It looks like this is due to using Math.round when computing the value.

Good point. I have no idea where the Math.round came from.

I managed to just edit the JS myself to remove round. My guess is it was included for line-height where it is probably more necessary?

It for sure is a bit klunky using half pixel sizes, but may as well let people do it if they want :-) Or perhaps there's another way to make the increments smaller. I'm not sure why there is such a big jump between sizes when the step is set to 1.

I think the line-height also needs to be non-rounded if this is changed.

Could you maybe create a PR of your changes?