Skip to content

refactor(menu): read display widths through a checked helper - #1179

Open
kronberger-droid wants to merge 1 commit into
nushell:mainfrom
kronberger-droid:refactor/columnar-menu-display-widths
Open

refactor(menu): read display widths through a checked helper#1179
kronberger-droid wants to merge 1 commit into
nushell:mainfrom
kronberger-droid:refactor/columnar-menu-display-widths

Conversation

@kronberger-droid

Copy link
Copy Markdown
Collaborator

Summary

format_plain and format_ansi indexed completions.display_widths[index] directly.
The index holds today, display_widths is built from the same values in one place (CompletionDisplay::new), so this folds both reads into a private display_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.

`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.
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.

1 participant