kylepaulsen / vscode-stretchy-spaces

An extension for vscode that allows you to change the width of indentation spaces.
24 stars 5 forks source link

Spaces briefly appear between characters on a new line. #4

Open FrobtheBuilder opened 5 years ago

FrobtheBuilder commented 5 years ago

So the intended behavior is that only the leading spaces on a line, the ones that signify an indentation should stretch, and the rest of the line should remain formatted normally. However, when you first start typing on a new line, if you have say 2 spaces stretched to 4, the characters you type appear with spaces between them for a fraction of a second. I assume this is an issue with an event not being fired until after you've already started typing, at which point it corrects itself and the extra spaces vanish so the text appears normal again. It's not a huge problem, but it is somewhat distracting to see the characters you're typing appear with spaces between them and then jump back into place every time you start a new line. I'd take a screenshot of the issue but I'm not fast enough to catch it before the formatting fixes itself. You should be able to reproduce it for yourself with a 2-4 config. Otherwise though, this extension is incredible and an absolute lifesaver. I'm shocked that nobody thought of this before.

gotjoshua commented 1 year ago

it seems that the updateDelay setting can remedy this situation, but it sets timeouts so may be resource intensive. Not sure if this happens for all open windows (hopefully not) or just the active one...

GeoffreyBooth commented 1 year ago

It’s even more annoying for the reverse configuration, compressing 4 spaces to 2. In that, the characters typed overlap.

I think the solution is to have the last space character be normal width. So in the 4-compressed-to-2 situation, instead of rendering each character as 0.25ch wide, we would render 0.333ch, 0.333ch, 0.333ch, 1ch. And in the 2-expanded-to-4 version, instead of rendering each as 2ch wide we would render 3ch, 1ch.