fix(cli): --zero breaks open-ended column ranges - #1354
Open
VXNCXNX wants to merge 1 commit into
Open
Conversation
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.
What's broken
--zerobreaks open-ended column ranges.Same intent, expressed in the offset the flag asks for, and it errors. The other end is wrong too, silently:
-C/--not-columnsshares the code and fails the same way:The fix
In
_resolve_column_identifier, the implicit ends of an open-ended range were hardcoded for 1-based identifiers:Both bounds live in identifier space, so both depend on
column_offset. Under--zerothe upper bound overshot by one and tripped the validity guard, and the lower bound started at the second column.All six shapes after the change:
Not undoing the recent exclusion fix
The Unreleased changelog has
fix: -C/--not-columns now excludes the last column of an open-ended range (e.g. 2-), which is what the+ 1on the upper bound is for. Under the defaultcolumn_offset=1,len + column_offsetis exactly the oldlen + 1, so that behaviour is untouched and only thecolumn_offset=0case changes. Its guard tests,test_exclude_open_ended_rangeandtest_exclude_ignores_unknown_names_but_reports_invalid_ranges, still pass, and-C 2:still yieldsa.Verification
test_range_notation_open_endedtested onlycolumn_offset=1, while its siblingtest_range_notationcovers both offsets. The missing offset-0 rows are added, for:3,1,4:,0:, and both offsets of the open-ended exclusion form.Reverting either bound alone fails the test, so both halves are independently covered.
Suite unchanged: 351 passed under
en_US.UTF-8before and after. Underde_DE.UTF-8it is 4 failed before and after, all pre-existing and in other utilities.Changelog entry added under Unreleased.