@@ -3,7 +3,6 @@ package tui
33import (
44 "fmt"
55 "strings"
6- "time"
76
87 tea "github.com/charmbracelet/bubbletea"
98 "github.com/charmbracelet/lipgloss"
@@ -38,18 +37,7 @@ type navEntry struct {
3837 parentNode * TreeNode // the node whose children are shown in current
3938}
4039
41- // animDirection indicates the slide direction for column transitions.
42- type animDirection int
43-
44- const (
45- animNone animDirection = iota
46- animLeft // drill in: columns slide left
47- animRight // go back: columns slide right
48- )
49-
50- const animFrames = 8 // number of animation frames
51-
52- // animTickMsg triggers the next animation frame.
40+ // animTickMsg is kept for backward compatibility (forwarded in app.go).
5341type animTickMsg struct {}
5442
5543// MillerView coordinates three columns: parent, current, and preview.
@@ -68,10 +56,6 @@ type MillerView struct {
6856 width int
6957 height int
7058 zenMode bool
71-
72- // Slide animation state
73- animDir animDirection
74- animRemaining int // frames remaining (0 = no animation)
7559}
7660
7761// NewMillerView creates a MillerView wired to the given preview engine.
@@ -138,14 +122,7 @@ func (m MillerView) Update(msg tea.Msg) (MillerView, tea.Cmd) {
138122 return m , nil
139123
140124 case animTickMsg :
141- if m .animRemaining > 0 {
142- m .animRemaining --
143- if m .animRemaining > 0 {
144- return m , tea .Tick (time .Millisecond * 50 , func (time.Time ) tea.Msg { return animTickMsg {} })
145- }
146- m .animDir = animNone
147- }
148- return m , nil
125+ return m , nil // no-op, animation removed
149126
150127 case tea.MouseMsg :
151128 return m .handleMouse (msg )
@@ -255,26 +232,18 @@ func (m MillerView) drillIn() (MillerView, tea.Cmd) {
255232 m .relayout ()
256233
257234 // Trigger preview for first item in new current column
258- var previewCmd tea.Cmd
259235 if node := m .current .SelectedNode (); node != nil {
260236 if len (node .Children ) > 0 {
261237 col := NewColumn (node .Label )
262238 col .SetItems (treeNodesToItems (node .Children ))
263239 m .preview .childColumn = & col
264240 m .relayout ()
265241 } else if node .QualifiedName != "" && node .Type != "" {
266- previewCmd = m .previewEngine .RequestPreview (node .Type , node .QualifiedName , m .preview .mode )
242+ return m , m .previewEngine .RequestPreview (node .Type , node .QualifiedName , m .preview .mode )
267243 }
268244 }
269245
270- // Start slide-left animation
271- m .animDir = animLeft
272- m .animRemaining = animFrames
273- animCmd := tea .Tick (time .Millisecond * 50 , func (time.Time ) tea.Msg { return animTickMsg {} })
274- if previewCmd != nil {
275- return m , tea .Batch (animCmd , previewCmd )
276- }
277- return m , animCmd
246+ return m , nil
278247}
279248
280249func (m MillerView ) goBack () (MillerView , tea.Cmd ) {
@@ -300,26 +269,18 @@ func (m MillerView) goBack() (MillerView, tea.Cmd) {
300269 m .relayout ()
301270
302271 // Trigger preview for selected item in restored current column
303- var previewCmd tea.Cmd
304272 if node := m .current .SelectedNode (); node != nil {
305273 if len (node .Children ) > 0 {
306274 col := NewColumn (node .Label )
307275 col .SetItems (treeNodesToItems (node .Children ))
308276 m .preview .childColumn = & col
309277 m .relayout ()
310278 } else if node .QualifiedName != "" && node .Type != "" {
311- previewCmd = m .previewEngine .RequestPreview (node .Type , node .QualifiedName , m .preview .mode )
279+ return m , m .previewEngine .RequestPreview (node .Type , node .QualifiedName , m .preview .mode )
312280 }
313281 }
314282
315- // Start slide-right animation
316- m .animDir = animRight
317- m .animRemaining = animFrames
318- animCmd := tea .Tick (time .Millisecond * 50 , func (time.Time ) tea.Msg { return animTickMsg {} })
319- if previewCmd != nil {
320- return m , tea .Batch (animCmd , previewCmd )
321- }
322- return m , animCmd
283+ return m , nil
323284}
324285
325286func (m MillerView ) togglePreviewMode () (MillerView , tea.Cmd ) {
@@ -543,34 +504,8 @@ func (m MillerView) columnWidths() (int, int, int) {
543504 previewW = minPreview
544505 }
545506
546- // Animation: shift parent/preview widths over frames
547- if m .animRemaining > 0 {
548- // Shift proportional to parent width, not total width
549- shift := max (1 , parentW * m .animRemaining / (animFrames * 2 ))
550- switch m .animDir {
551- case animLeft :
552- parentW -= shift
553- previewW += shift
554- case animRight :
555- parentW += shift
556- previewW -= shift
557- }
558- if parentW < 4 {
559- parentW = 4
560- }
561- if previewW < 20 {
562- previewW = 20
563- }
564- // Rebalance current
565- currentW = usable - parentW - previewW
566- if currentW < 10 {
567- currentW = 10
568- previewW = usable - parentW - currentW
569- }
570- }
571-
572- Trace ("miller: columnWidths usable=%d ideal(p=%d,c=%d) result(p=%d,c=%d,pv=%d) anim=%d/%v" ,
573- usable , idealParent , idealCurrent , parentW , currentW , previewW , m .animRemaining , m .animDir )
507+ Trace ("miller: columnWidths usable=%d ideal(p=%d,c=%d) result(p=%d,c=%d,pv=%d)" ,
508+ usable , idealParent , idealCurrent , parentW , currentW , previewW )
574509 return parentW , currentW , previewW
575510}
576511
0 commit comments