MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / SliceViewportText

Function SliceViewportText

ui/fullscreen_backend.go:362–376  ·  view source on GitHub ↗
(text string, offset, height int)

Source from the content-addressed store, hash-verified

360}
361
362func SliceViewportText(text string, offset, height int) string {
363 lines := strings.Split(text, "\n")
364 if text == "" {
365 return ""
366 }
367 start := maxInt(0, offset)
368 end := maxInt(start, start+maxInt(1, height))
369 if start > len(lines) {
370 start = len(lines)
371 }
372 if end > len(lines) {
373 end = len(lines)
374 }
375 return strings.Join(lines[start:end], "\n")
376}
377
378func (b *FullscreenRendererBackend) ScrollPane(pane, text string, delta, height int) {
379 lines := strings.Split(text, "\n")

Calls 1

maxIntFunction · 0.85