Can someone help me understand how tab expansion is supposed to work, particular w.r.t. indented code blocks?
4.4 says:
An indented chunk is a sequence of non-blank lines, each indented four or more spaces. The contents of the code block are the literal contents of the lines, including trailing line endings, minus four spaces of indentation.
(emphasis mine)
2.2 says:
in contexts where whitespace helps to define block structure, tabs behave as if they were replaced by spaces with a tab stop of 4 characters.
If I have an indented code block with 4 leading spaces or one with a single leading tab then I get a code block with no leading spaces. Simple enough.
If I have an indented code block with 6 leading spaces I get a code block with 2 leading spaces. Makes sense.
However, if I have an indented code block with 2 leading spaces followed by a tab I get a code block with no leading spaces. Why? I would expect a code block containing 2 leading spaces. Curiously, if I have an indented code block with a tab followed by two leading spaces I get the desired behavior, a code block containing 2 leading spaces.
Can anyone help me understand what’s going on here? An implementation bug or something I’m just not understanding in the spec?