()
| 927 | } |
| 928 | |
| 929 | func (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 | |
| 961 | func (v *PricingView) renderSuggestions(active bool) string { |
| 962 | cmdActive := active && v.ActiveSection == PricingSectionCommand |
no outgoing calls
no test coverage detected