vscode-stretchy-spaces icon indicating copy to clipboard operation
vscode-stretchy-spaces copied to clipboard

Whitespace characters stretch incorrectly with proportional-width fonts.

Open subhav opened this issue 5 years ago • 3 comments

I'm using the following settings:

"editor.fontFamily": "Arial",
"editor.renderWhitespace": "selection",
"stretchySpaces.targetIndentation": 6,

To reproduce, just make a selection.

The "whitespace character" (the dot that's used to indicate a space) in Arial is a different size than actual spaces, so text moves around as the selection changes.

subhav avatar Oct 10 '20 18:10 subhav

Is there a way in CSS to represent "the width of the space character"?

GeoffreyBooth avatar Oct 10 '20 23:10 GeoffreyBooth

Oh hah, I guess that's actually a separate issue -- using ch isn't accurate for a proportional font.

It seems that VSCode normally explicitly sets the width of those whitespace characters in a selection to make them the same size as a space, but that doesn't happen with this extension enabled.

Here's an example of this bug in action. Notice how the line after the selection is shifted a few pixels to the right. image

Here's a span element that represents the selection of one space without this extension enabled. image

And, with the extension. The computed width is missing. image

subhav avatar Oct 11 '20 22:10 subhav

It's probably worth mentioning... stretching spaces to match some target tab size is not actually why I'm trying out this extension.

Spaces in proportional-width fonts are much narrower than other characters. What I really want is an extension that makes every indentation space exactly 1ch in width.

subhav avatar Oct 12 '20 00:10 subhav