explore: cursor can leave the viewport on a one-row terminal, and ctrl+d on an empty list sets cursor to -1
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 74/100
Research direction
Start in cmd/openapi/internal/explore/tui/model.go, focusing on ensureCursorVisible, calculateContentHeight, and the ctrl+d handling. Run the key-handler tests, including TestUpdate_HalfPageKeys/ctrl+u still moves one row on a tiny terminal; done means both boundary cases stay within valid cursor and viewport bounds and the tests assert those bounds.
Written by the indexing model from the issue text.
Description
Two boundary cases in cmd/openapi/internal/explore/tui/model.go, found while adding key-handler tests for #254. Both are on main today and unrelated to the bubbletea v2 change.
-
ensureCursorVisiblecannot fit the cursor on a one-row content area. Withheight: 8,calculateContentHeight()returns 1. Once the cursor is past row 0, any non-zeroscrollOffsetcosts one line for the "more items above" indicator plus one for the cursor row, which never fits in 1, so the search loop finds no offset and leavesscrollOffset = 0with the cursor off-screen. Measured:height=8, cursor=5 -> scrollOffset=0, visible rows 0..0. The testTestUpdate_HalfPageKeys/ctrl+u still moves one row on a tiny terminaldocuments this by skipping the viewport assertion. -
ctrl+don an empty operation list setscursor = -1:maxItems = len(m.operations) - 1is -1 and the clamp assigns it. Unreachable through the CLI, sinceexploreandsnipboth refuse an empty list before starting the TUI, so this is hygiene rather than a user-visible bug.
Suggested fixes: for (1), either let the cursor row win over the indicator when only one row fits, or have calculateContentHeight reserve the indicator line so the loop's budget is honest; for (2), the same len(m.operations) > 0 guard G already has. Happy to send a PR for both once #254 lands, so the tests can assert the tight bound everywhere.
- Dominant language
- Go
- Stars
- 276
- Forks
- 18
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 8
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from speakeasy-api/openapi
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
speakeasy-api/openapi#201 ·
All issues in speakeasy-api/openapi
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100