Align visible tabs with tab stops by yuefdev · Pull Request #3408 · pygments/pygments · GitHub
Skip to content

Align visible tabs with tab stops - #3408

Open
yuefdev wants to merge 1 commit into
pygments:masterfrom
yuefdev:fix/visible-tab-stops
Open

yuefdev wants to merge 1 commit into
pygments:masterfrom
yuefdev:fix/visible-tab-stops

Conversation

@yuefdev

@yuefdev yuefdev commented Oct 17, 2026

Copy link
Copy Markdown

Fixes #990.

Visible tabs currently expand to a full tab width even part-way through a line, shifting the following text. Track the source column across tokens and expand each tab only to the next stop. Reset the column at line breaks and preserve the original token types when wstokentype=False.

Regression cases cover split tokens, consecutive tabs, aligned tabs and line breaks in both token modes.

Checks: full tox run, 5,342 passed and 16 skipped; focused filter tests; Ruff; git diff --check.

Prepared and verified with AI assistance (OpenCode, gpt-6.1-sol).

Signed-off-by: Yusuf Efe <120668197+yuefdev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Whitespace filter misaligns text following hard-tab not occurring on tab-stop

1 participant