MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / adjustStoriesScroll

Method adjustStoriesScroll

internal/tui/app.go:2141–2163  ·  view source on GitHub ↗

adjustStoriesScroll ensures the selected index is visible in the scroll window.

()

Source from the content-addressed store, hash-verified

2139
2140// adjustStoriesScroll ensures the selected index is visible in the scroll window.
2141func (a *App) adjustStoriesScroll() {
2142 listHeight := a.storiesListHeight()
2143 if listHeight <= 0 {
2144 return
2145 }
2146 if a.selectedIndex < a.storiesScrollOffset {
2147 a.storiesScrollOffset = a.selectedIndex
2148 }
2149 if a.selectedIndex >= a.storiesScrollOffset+listHeight {
2150 a.storiesScrollOffset = a.selectedIndex - listHeight + 1
2151 }
2152 // Clamp
2153 maxOffset := len(a.prd.UserStories) - listHeight
2154 if maxOffset < 0 {
2155 maxOffset = 0
2156 }
2157 if a.storiesScrollOffset > maxOffset {
2158 a.storiesScrollOffset = maxOffset
2159 }
2160 if a.storiesScrollOffset < 0 {
2161 a.storiesScrollOffset = 0
2162 }
2163}
2164
2165// markStoryInProgress clears any existing in-progress flags and marks the
2166// given story as in-progress, then reloads the PRD from disk.

Callers 8

UpdateMethod · 0.95
selectStoryByIDMethod · 0.95
selectInProgressStoryMethod · 0.95
handlePRDUpdateMethod · 0.95

Calls 1

storiesListHeightMethod · 0.95