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

Function FormatContextProgressBar

ui/context_status.go:57–75  ·  view source on GitHub ↗
(usedTokens, limitTokens int, width int)

Source from the content-addressed store, hash-verified

55}
56
57func FormatContextProgressBar(usedTokens, limitTokens int, width int) string {
58 if width <= 0 {
59 width = 20
60 }
61 if limitTokens <= 0 {
62 return "[" + strings.Repeat("-", width) + "]"
63 }
64 if usedTokens < 0 {
65 usedTokens = 0
66 }
67 filled := int(math.Round(float64(usedTokens) / float64(limitTokens) * float64(width)))
68 if filled < 0 {
69 filled = 0
70 }
71 if filled > width {
72 filled = width
73 }
74 return "[" + strings.Repeat("#", filled) + strings.Repeat("-", width-filled) + "]"
75}
76
77func formatTokenCount(tokens int) string {
78 if tokens < 0 {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected