fix(cli): keep the explore cursor on screen when no scroll offset fits - #257
Open
david-long1 wants to merge 1 commit into
Open
david-long1 wants to merge 1 commit into
david-long1 wants to merge 1 commit into
Conversation
ensureCursorVisible charges the "more items above" indicator against the content height, so with a one-row content area (height 8) no offset ever fits and the search loop leaves the cursor off-screen. The same happens when an unfolded item is taller than the content area. When nothing fits, scroll so the cursor row is at the top: the view draws the indicator above it and the cursor stays visible. ctrl+d on an empty operation list clamped the cursor to -1; guard it like G does. The half-page test on a tiny terminal now asserts the cursor is on screen instead of skipping that check. Fixes speakeasy-api#255
Contributor
📊 Test Coverage ReportCurrent Coverage: Coverage Change: ✅ No change Coverage by Package
📋 Detailed Coverage by Function (click to expand)
Generated by GitHub Actions |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TristanSpeakEasy
approved these changes
Sep 21, 2026
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.
On a terminal with a one-row content area,
spec explorecan move the cursor off-screen:ensureCursorVisiblecharges the "more items above" indicator against the content height, so once the cursor is past row 0 no scroll offset ever fits and the loop gives up withscrollOffset = 0. The same happens for an unfolded item taller than the content area. Separately,ctrl+don an empty operation list clamps the cursor to -1.When no offset fits, scroll so the cursor row is at the top; the view still draws the indicator above it, so the cursor stays visible.
ctrl+dgets the samelen(m.operations) > 0guardGalready has. The tiny-terminal half-page test now asserts the cursor is on screen instead of skipping that check, with new cases for the empty list, a single-row area, and a tall unfolded item.Fixes #255.
Verified in an 80×8 tmux pane on
openapi/testdata/inline/inline_expected.yaml(19 operations), pressingjfive times thenctrl+u:main: the pane keeps showing row 0 (GET /external-users) after every key; the cursor is off-screen and nothing appears to move.⬆ More items above...followed by the cursor row —GET /mixed/user-with-external-profileafter thejs,GET /external/usersafterctrl+u.