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

Method getViewportStartLine

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

Source from the content-addressed store, hash-verified

145 }
146
147 getViewportStartLine(maxVisibleLines?: number): number {
148 if (maxVisibleLines === undefined || maxVisibleLines <= 0) return 0
149 const { line } = this.getPosition()
150 const allLines = this.measuredText.getWrappedText()
151 if (allLines.length <= maxVisibleLines) return 0
152 const half = Math.floor(maxVisibleLines / 2)
153 let startLine = Math.max(0, line - half)
154 const endLine = Math.min(allLines.length, startLine + maxVisibleLines)
155 if (endLine - startLine < maxVisibleLines) {
156 startLine = Math.max(0, endLine - maxVisibleLines)
157 }
158 return startLine
159 }
160
161 getViewportCharOffset(maxVisibleLines?: number): number {
162 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