MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / suggestionCols

Method suggestionCols

internal/tui/views/pricing.go:929–959  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

927}
928
929func (v *PricingView) suggestionCols() int {
930 if v.Width < 10 {
931 return 1
932 }
933 innerW := v.Width - 4
934 if len(v.SuggestionsCache) == 0 {
935 return 1
936 }
937 maxDisplay := 10
938 maxReason := 0
939 for _, s := range v.SuggestionsCache {
940 if len(s.Display) > maxDisplay {
941 maxDisplay = len(s.Display)
942 }
943 if len(s.Reason) > maxReason {
944 maxReason = len(s.Reason)
945 }
946 }
947 cellW := 4 + maxDisplay + 2 + maxReason
948 if cellW < 18 {
949 cellW = 18
950 }
951 if cellW > 38 {
952 cellW = 38
953 }
954 cols := innerW / cellW
955 if cols < 1 {
956 cols = 1
957 }
958 return cols
959}
960
961func (v *PricingView) renderSuggestions(active bool) string {
962 cmdActive := active && v.ActiveSection == PricingSectionCommand

Callers 2

renderSuggestionsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected