Repository navigation
[Rejected AI junk] indent: honor blank=False for empty first line when first=True - #2268
Closed
devtechedge wants to merge 1 commit into
Closed
devtechedge wants to merge 1 commit into
devtechedge wants to merge 1 commit into
Conversation
When first=True and blank=False, skip indenting an empty first line (including fully empty input) so blank keeps its meaning for the first line as well. Fixes #2176.
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
indent(..., first=True)was always prefixing the indent width, even when the first line was empty andblankwas left at its defaultFalse. That made empty input (and an empty first line) render as spaces instead of staying empty.Example from #2176:
first=Truestill indents a non-empty first line. Withblank=True, an empty first line is still indented.Changes
first=Trueifblank=Trueor the first line is non-emptyCHANGES.rst+versionchangednote for 3.2fixes #2176
Test plan
pytest tests/test_filters.py -k indent(4 passed)tests/test_filters.py(133 passed)