Skip to content

refactor(menu): slice the list page with get instead of indexing - #1180

Open
kronberger-droid wants to merge 1 commit into
nushell:mainfrom
kronberger-droid:refactor/list-menu-page-slice
Open

refactor(menu): slice the list page with get instead of indexing#1180
kronberger-droid wants to merge 1 commit into
nushell:mainfrom
kronberger-droid:refactor/list-menu-page-slice

Conversation

@kronberger-droid

Copy link
Copy Markdown
Collaborator

Summary

The page slice in ListMenu::get_values clamps end to the values but sums start from the recorded page sizes.
If those ever outrun values (pages built for an earlier, longer result), start > end and the range indexing panics mid-paint.
get(start..end).unwrap_or(&[]) shows the empty menu, NO RECORDS FOUND, instead.
No behaviour change while the page sizes are consistent, no public API change.

`end` is clamped to the values but `start` is summed from the recorded
page sizes; if those ever outrun `values` (pages built for an earlier,
longer result) `start > end` and the range panics mid-paint. `get` shows
the empty menu, NO RECORDS FOUND, instead.
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