Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/root/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (f *newFlags) runNewCommand(cmd *cobra.Command, args []string) error {

progOpts := []tea.ProgramOption{
tea.WithContext(ctx),
tea.WithFilter(tui.MouseEventFilter),
}

p := tea.NewProgram(m, progOpts...)
Expand Down
1 change: 0 additions & 1 deletion cmd/root/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ func handleRunMode(ctx context.Context, agentFilename string, rt runtime.Runtime

progOpts := []tea.ProgramOption{
tea.WithContext(ctx),
tea.WithFilter(tui.MouseEventFilter),
}

p := tea.NewProgram(m, progOpts...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/tui/components/messages/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (m *model) Update(msg tea.Msg) (layout.Model, tea.Cmd) {
return m, nil

case tea.MouseWheelMsg:
const mouseScrollAmount = 3
const mouseScrollAmount = 2
buttonStr := msg.Button.String()

switch buttonStr {
Expand Down
16 changes: 0 additions & 16 deletions pkg/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package tui
import (
"context"
"fmt"
"time"

"charm.land/bubbles/v2/help"
"charm.land/bubbles/v2/key"
Expand All @@ -27,21 +26,6 @@ import (
"github.com/docker/cagent/pkg/tui/styles"
)

var lastMouseEvent time.Time

// MouseEventFilter filters mouse events to prevent spam
func MouseEventFilter(_ tea.Model, msg tea.Msg) tea.Msg {
switch msg.(type) {
case tea.MouseWheelMsg, tea.MouseMotionMsg, tea.MouseMsg:
now := time.Now()
if now.Sub(lastMouseEvent) < 20*time.Millisecond {
return nil
}
lastMouseEvent = now
}
return msg
}

// appModel represents the main application model
type appModel struct {
application *app.App
Expand Down
Loading