@@ -25,102 +25,6 @@ const (
2525 configRowComingSoon
2626)
2727
28- // Garden settings are shown directly under "Rain animation mode" (row index 4).
29- // Logical indices 0–len(configRows)-1 are the static menu; len(configRows)+
30- // offset are the garden-only rows (see logicalRowIndex).
31- var gardenSettingsConfigRows = []configRow {
32- {label : "Garden bloom pace" , kind : configRowEnum , options : []string {
33- config .UIGardenBloomCalm ,
34- config .UIGardenBloomNormal ,
35- config .UIGardenBloomFast ,
36- }},
37- {label : "Garden moisture cap" , kind : configRowEnum , options : []string {
38- config .UIGardenMoistureOff ,
39- config .UIGardenMoistureSoft ,
40- config .UIGardenMoistureTight ,
41- }},
42- }
43-
44- func normalizedRainAnimMode (cfg * config.Config ) string {
45- if cfg == nil || strings .TrimSpace (cfg .UI .RainAnimationMode ) == "" {
46- return config .UIRainAnimationBasic
47- }
48- return cfg .UI .RainAnimationMode
49- }
50-
51- func gardenSettingsRowCount (cfg * config.Config ) int {
52- if cfg != nil && strings .EqualFold (strings .TrimSpace (cfg .UI .RainAnimationMode ), config .UIRainAnimationGarden ) {
53- return len (gardenSettingsConfigRows )
54- }
55- return 0
56- }
57-
58- func visibleConfigRowCount (cfg * config.Config ) int {
59- return len (configRows ) + gardenSettingsRowCount (cfg )
60- }
61-
62- // logicalRowIndex maps a visible menu index to the legacy row id used in
63- // configRowValue / applyConfigChange (garden rows use ids len(configRows)..).
64- func logicalRowIndex (visibleI int , cfg * config.Config ) int {
65- g := gardenSettingsRowCount (cfg )
66- if g == 0 {
67- return visibleI
68- }
69- if visibleI < 5 {
70- return visibleI
71- }
72- if visibleI < 5 + g {
73- return len (configRows ) + (visibleI - 5 )
74- }
75- return visibleI - g
76- }
77-
78- func configRowAt (visibleI int , cfg * config.Config ) configRow {
79- li := logicalRowIndex (visibleI , cfg )
80- if li >= len (configRows ) {
81- gi := li - len (configRows )
82- if gi >= 0 && gi < len (gardenSettingsConfigRows ) {
83- return gardenSettingsConfigRows [gi ]
84- }
85- return configRows [len (configRows )- 1 ]
86- }
87- return configRows [li ]
88- }
89-
90- func clampConfigCursor (cfg * config.Config , cur int ) int {
91- n := visibleConfigRowCount (cfg )
92- if n <= 0 {
93- return 0
94- }
95- if cur >= n {
96- return n - 1
97- }
98- if cur < 0 {
99- return 0
100- }
101- return cur
102- }
103-
104- func normalizedGardenBloom (s string ) string {
105- s = strings .TrimSpace (strings .ToLower (s ))
106- switch s {
107- case config .UIGardenBloomCalm , config .UIGardenBloomNormal , config .UIGardenBloomFast :
108- return s
109- default :
110- return config .UIGardenBloomNormal
111- }
112- }
113-
114- func normalizedGardenMoisture (s string ) string {
115- s = strings .TrimSpace (strings .ToLower (s ))
116- switch s {
117- case config .UIGardenMoistureOff , config .UIGardenMoistureSoft , config .UIGardenMoistureTight :
118- return s
119- default :
120- return config .UIGardenMoistureOff
121- }
122- }
123-
12428var configRows = []configRow {
12529 {label : "Default mode" , kind : configRowEnum , options : []string {
12630 "sync-default" ,
@@ -137,7 +41,6 @@ var configRows = []configRow{
13741 config .UIRainAnimationBasic ,
13842 config .UIRainAnimationAdvanced ,
13943 config .UIRainAnimationMatrix ,
140- config .UIRainAnimationGarden ,
14144 }},
14245 {label : "Show flavor quotes" , kind : configRowBool },
14346 {label : "Flavor quote behavior" , kind : configRowEnum , options : []string {
@@ -154,11 +57,11 @@ var configRows = []configRow{
15457 {label : "Custom hex palette" , kind : configRowComingSoon },
15558}
15659
157- func configRowValue (visibleI int , cfg * config.Config ) string {
60+ func configRowValue (i int , cfg * config.Config ) string {
15861 if cfg == nil {
15962 return ""
16063 }
161- switch logicalRowIndex ( visibleI , cfg ) {
64+ switch i {
16265 case 0 :
16366 return cfg .Global .DefaultMode
16467 case 1 :
@@ -196,23 +99,18 @@ func configRowValue(visibleI int, cfg *config.Config) string {
19699 return cfg .UI .ColorProfile
197100 case 10 :
198101 return "coming soon"
199- case 11 :
200- return normalizedGardenBloom (cfg .UI .GardenBloomPreset )
201- case 12 :
202- return normalizedGardenMoisture (cfg .UI .GardenMoistureCap )
203102 }
204103 return ""
205104}
206105
207- func applyConfigChange (visibleI int , cfg * config.Config , dir int ) {
106+ func applyConfigChange (i int , cfg * config.Config , dir int ) {
208107 if cfg == nil {
209108 return
210109 }
211- row := configRowAt (visibleI , cfg )
212- li := logicalRowIndex (visibleI , cfg )
110+ row := configRows [i ]
213111 switch row .kind {
214112 case configRowBool :
215- switch li {
113+ switch i {
216114 case 1 :
217115 cfg .Global .DisableScan = ! cfg .Global .DisableScan
218116 case 3 :
@@ -222,7 +120,7 @@ func applyConfigChange(visibleI int, cfg *config.Config, dir int) {
222120 }
223121 case configRowEnum :
224122 opts := row .options
225- cur := configRowValue (visibleI , cfg )
123+ cur := configRowValue (i , cfg )
226124 idx := 0
227125 for j , o := range opts {
228126 if o == cur {
@@ -231,7 +129,7 @@ func applyConfigChange(visibleI int, cfg *config.Config, dir int) {
231129 }
232130 }
233131 idx = (idx + dir + len (opts )) % len (opts )
234- switch li {
132+ switch i {
235133 case 0 :
236134 cfg .Global .DefaultMode = opts [idx ]
237135 case 2 :
@@ -252,10 +150,6 @@ func applyConfigChange(visibleI int, cfg *config.Config, dir int) {
252150 applyRainTickChange (cfg , opts , dir )
253151 case 9 :
254152 cfg .UI .ColorProfile = opts [idx ]
255- case 11 :
256- cfg .UI .GardenBloomPreset = opts [idx ]
257- case 12 :
258- cfg .UI .GardenMoistureCap = opts [idx ]
259153 }
260154 case configRowComingSoon :
261155 // reserved
@@ -313,13 +207,12 @@ func (m RepoSelectorModel) updateConfigView(msg tea.KeyMsg, cmds []tea.Cmd) (tea
313207 }
314208
315209 case "down" , "j" :
316- if m .configCursor < visibleConfigRowCount ( m . cfg )- 1 {
210+ if m .configCursor < len ( configRows )- 1 {
317211 m .configCursor ++
318212 }
319213
320214 case " " , "right" , "l" :
321215 applyConfigChange (m .configCursor , m .cfg , + 1 )
322- m .configCursor = clampConfigCursor (m .cfg , m .configCursor )
323216 if m .cfg != nil {
324217 applyColorProfile (m .cfg .UI .ColorProfile )
325218 }
@@ -328,7 +221,6 @@ func (m RepoSelectorModel) updateConfigView(msg tea.KeyMsg, cmds []tea.Cmd) (tea
328221
329222 case "left" , "h" :
330223 applyConfigChange (m .configCursor , m .cfg , - 1 )
331- m .configCursor = clampConfigCursor (m .cfg , m .configCursor )
332224 if m .cfg != nil {
333225 applyColorProfile (m .cfg .UI .ColorProfile )
334226 }
@@ -381,8 +273,7 @@ func (m RepoSelectorModel) viewConfig() string {
381273 valueStyle := lipgloss .NewStyle ().Foreground (activeProfile ().configValue ).Bold (true )
382274 dimStyle := lipgloss .NewStyle ().Foreground (activeProfile ().configDim )
383275
384- for i := 0 ; i < visibleConfigRowCount (m .cfg ); i ++ {
385- row := configRowAt (i , m .cfg )
276+ for i , row := range configRows {
386277 cur := " "
387278 if m .configCursor == i {
388279 cur = ">"
@@ -452,7 +343,6 @@ func (m RepoSelectorModel) syncRuntimeFromConfig(cmds []tea.Cmd) (RepoSelectorMo
452343 m .rainAnimationMode = m .cfg .UI .RainAnimationMode
453344 if m .rainBg != nil {
454345 m .rainBg .Mode = m .rainAnimationMode
455- m .rainBg .ApplyGardenFromConfig (m .cfg )
456346 }
457347 m .showStartupQuote = m .cfg .UI .ShowStartupQuote
458348 m .startupQuoteBehavior = m .cfg .UI .StartupQuoteBehavior
0 commit comments