Skip to content

Indentation is incorrectly changed for tabulated comments after a dedent #262

Description

@sciyoshi

Operating system: Ubuntu 18.04
Python version: 3.6.3
Black version: master

Thank you @ambv for this library. When trying to run this on a codebase that uses tabs, indentation for comments past depth 0 is changed incorrectly after a dedent. Sample input (NB tabs):

if 1:
	if 2:
		pass
	# This comment should be indented the same as the next line
	pass

Black reformats this to:

if 1:
    if 2:
        pass
        # This comment should be indented the same as the next line
    pass

Note that this only happens when the input file uses tabs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.T: bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions