package model import ( "time" tea "charm.land/bubbletea/v2" ) var lastMouseEvent time.Time func MouseEventFilter(m tea.Model, msg tea.Msg) tea.Msg { switch msg.(type) { case tea.MouseWheelMsg, tea.MouseMotionMsg: now := time.Now() // trackpad is sending too many requests if now.Sub(lastMouseEvent) < 15*time.Millisecond { return nil } lastMouseEvent = now } return msg }