ecode
ecode copied to clipboard
uneven characters + tabs not aligning
blah(); // my comment blah2(); // my other comment
In the two lines above, which only uses tabs, I expect the comments to align, but in ecode they don't:
Thanks,
Hi Andy! But that shouldn't align based on the character count. The editor shouldn't do any alignment on monospaced text (maybe I'm opinionated about this). I'm not sure if I understand what you are expecting.
Some editors "cut" the \t character to align based on the character count, but it won't produce better results in this case:
blah(); // my comment
blah2(); // my comment
This is vscode:
AFAIK most editors behave like vscode. That request makes sense, I particularly don't like it. I think alignment should be "hardcoded" with spaces, precisely for this reason, there is not a standard way of aligning tabs.
I'm open to changing the default behavior optionally, but it would require several modifications. I'm not sure it's worth it (at least for the moment).
In my experience, tabs are expanded 'til the next tab stop. If there are no defined tab stops, the default "every multiple of 8" is used.
Most modern editors allow you to set how many spaces are displayed for tabs, and the number of spaces should be used as the default tab stops. A single tab character is still saved in the file, and moving the cursor will "jump" that many spaces as if it was a "real" tab.
Last, a fully-fledged "editor" (such as for documentation) will allow setting each tab stop individually. Could be given as a list, such as 4, 12, 20, 52
, meaning those columns are the tab stops. Rarely used, almost never for a code editor. Could be handy for those README files, though. :-)