MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getViewportStartLine

Method getViewportStartLine

src/utils/Cursor.ts:172–184  ·  view source on GitHub ↗
(maxVisibleLines?: number)

Source from the content-addressed store, hash-verified

170 }
171
172 getViewportStartLine(maxVisibleLines?: number): number {
173 if (maxVisibleLines === undefined || maxVisibleLines <= 0) return 0
174 const { line } = this.getPosition()
175 const allLines = this.measuredText.getWrappedText()
176 if (allLines.length <= maxVisibleLines) return 0
177 const half = Math.floor(maxVisibleLines / 2)
178 let startLine = Math.max(0, line - half)
179 const endLine = Math.min(allLines.length, startLine + maxVisibleLines)
180 if (endLine - startLine < maxVisibleLines) {
181 startLine = Math.max(0, endLine - maxVisibleLines)
182 }
183 return startLine
184 }
185
186 getViewportCharOffset(maxVisibleLines?: number): number {
187 const startLine = this.getViewportStartLine(maxVisibleLines)

Callers 5

getViewportCharOffsetMethod · 0.95
getViewportCharEndMethod · 0.95
renderMethod · 0.95
PromptInputFunction · 0.80
useTextInputFunction · 0.80

Calls 3

getPositionMethod · 0.95
getWrappedTextMethod · 0.80
maxMethod · 0.80

Tested by

no test coverage detected