#2373·lapce

Support vertical alignment of variable-width fonts with elastic tabstops

Author: eugenesvkCreated May 14, 2023Updated Sep 10, 2026
LabelsC-featureA-font

Is your feature request related to a problem? Please describe.

Variable-width (proportional) fonts are better looking (they don't need to squeeze

  • wwwwww wide letters to match narrow
  • iiiiii narrow ones

however, when it comes to coding, they have a big downside — they break vertical alignment

In the most simple case when you have the same number of letters:

python
variii = 1
varwww = 2

↑this is aligned fine ↓this isn't variii = 1 varwww = 2

In the more complicated cases of different number of letters you couldn't even align it manually in the first place since variable-width spaces are invalid

You can have variable-width tabs to deal with this issue as is done in many WYSIWYG rich text editors like Word (or known as Elastic Tabstops), where tab takes whatever width is required to reach a "tabstop", in the example above the tabstop would align with =, which is the first non-whitespace char in the column of text, so all equal signs would be aligned vertically perfectly

In our simulated example (with variable-width spaces) that would look like this with having different width

variii       ⭾= 1 varwww ⭾= 2

Describe the solution you'd like

So the solution would be for Lapce to implement the algorithmth from Elastic Tabstops that would allow achieving this alignment

Describe alternatives you've considered

This could be a plugin, but then it would also require architectural support from the editor core (e.g., in Sublime Text that supports proportional fonts you can't adjust tab width, so a plugin can only add spaces to fix alignment, but it doesn't work properly since allowed spaces have a fixed width) Is this possible with the current plugin architecture?

Additional context