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

Function ansiSkip

internal/tui/completion.go:504–524  ·  view source on GitHub ↗

ansiSkip skips the first skipWidth visual columns of an ANSI-styled string and returns the remainder.

(s string, skipWidth int)

Source from the content-addressed store, hash-verified

502// ansiSkip skips the first skipWidth visual columns of an ANSI-styled string
503// and returns the remainder.
504func ansiSkip(s string, skipWidth int) string {
505 width := 0
506 inEscape := false
507 for i, r := range s {
508 if r == '\033' {
509 inEscape = true
510 continue
511 }
512 if inEscape {
513 if (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') {
514 inEscape = false
515 }
516 continue
517 }
518 if width >= skipWidth {
519 return s[i:]
520 }
521 width++
522 }
523 return ""
524}
525
526// overlayModal composites a modal on top of a background, centering the modal.
527func overlayModal(background, modal string, screenWidth, screenHeight int) string {

Callers 1

overlayModalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected