refactor(menu): read display widths through a checked helper - #1179
Open
kronberger-droid wants to merge 1 commit into
Open
refactor(menu): read display widths through a checked helper#1179kronberger-droid wants to merge 1 commit into
kronberger-droid wants to merge 1 commit into
Conversation
`display_widths` is built from the same `values` in `CompletionDisplay::new`, so the two indexings in `format_plain` and `format_ansi` held. `display_width(index)` answers with 0 out of range, so a slipped invariant paints an unpadded row instead of aborting mid-repaint.
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
format_plainandformat_ansiindexedcompletions.display_widths[index]directly.The index holds today,
display_widthsis built from the samevaluesin one place (CompletionDisplay::new), so this folds both reads into a privatedisplay_width(index)that answers 0 out of range: a slipped invariant paints an unpadded row instead of aborting mid-repaint.No behaviour change, no public API change.