Search code examples
visual-studio-codesublimetext3pep8rulers

Why is my 80 character ruler between Sublime Text3 and VS Code so different?


I have my ruler settings in Sublime Text 3 and VS Code at 80. In my sublime image I separate my functions using "#---#" which is as wide as the 80 character ruler. When I open the same file in VS code the ruler is nowhere near the 80 character limit, its somewhere in the hundreds. Does anybody know what's going on?

Below is a screenshot from Sublime Text 3 enter image description here

Below is a screenshot from VS Code: enter image description here

Notice the different placement of the 80 character ruler.


Solution

  • It looks as though you're not using the same font in both cases, and in fact the font in Sublime is Fixed Width while the font in VSC is Proportional.

    This is visible not only in the rulers, but in the code itself. For example, presuming it's the same file in both screen shots, the indent looks to be 4 characters in Sublime and 3 in VSC.

    Both things are a symptom of a Proportional font; a font in which the width of each character is potentially distinct, unlike a Fixed Width font in which every character is the same width.

    In a Fixed Width font, an X and a dash are the same width (for example), but in a Proportional font a dash is usually narrower (and a space much more so). As a result the ruler being at character position 80 doesn't line up with the actual character at position 80 because the text isn't long enough.