diff --git a/cmd/soft/browse/browse.go b/cmd/soft/browse/browse.go index c430630cf..ba8ad2caa 100644 --- a/cmd/soft/browse/browse.go +++ b/cmd/soft/browse/browse.go @@ -167,8 +167,11 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Quit } case tea.MouseMsg: - switch msg.Type { - case tea.MouseLeft: + if msg.Action != tea.MouseActionPress { + break + } + switch msg.Button { + case tea.MouseButtonLeft: switch { case m.common.Zone.Get("footer").InBounds(msg): cmds = append(cmds, footer.ToggleFooterCmd) diff --git a/pkg/db/migrate/0003_migrate_lfs_objects.go b/pkg/db/migrate/0003_migrate_lfs_objects.go index 70aaa79e8..d7acd7be7 100644 --- a/pkg/db/migrate/0003_migrate_lfs_objects.go +++ b/pkg/db/migrate/0003_migrate_lfs_objects.go @@ -27,11 +27,11 @@ var migrateLfsObjects = Migration{ cfg := config.FromContext(ctx) logger := log.FromContext(ctx).WithPrefix("migrate_lfs_objects") - var repoIds []int64 - if err := tx.Select(&repoIds, "SELECT id FROM repos"); err != nil { + var repoIDs []int64 + if err := tx.Select(&repoIDs, "SELECT id FROM repos"); err != nil { return err } - for _, r := range repoIds { + for _, r := range repoIDs { var objs []models.LFSObject if err := tx.Select(&objs, "SELECT * FROM lfs_objects WHERE repo_id = ?", r); err != nil { return err @@ -50,7 +50,7 @@ var migrateLfsObjects = Migration{ } return nil }, - Rollback: func(ctx context.Context, tx *db.Tx) error { + Rollback: func(context.Context, *db.Tx) error { return nil }, } diff --git a/pkg/ssh/ssh.go b/pkg/ssh/ssh.go index 4cfde71c2..54d30dcae 100644 --- a/pkg/ssh/ssh.go +++ b/pkg/ssh/ssh.go @@ -104,7 +104,7 @@ func NewSSHServer(ctx context.Context) (*SSHServer, error) { } if config.IsDebug() { - s.srv.ServerConfigCallback = func(ctx ssh.Context) *gossh.ServerConfig { + s.srv.ServerConfigCallback = func(_ ssh.Context) *gossh.ServerConfig { return &gossh.ServerConfig{ AuthLogCallback: func(conn gossh.ConnMetadata, method string, err error) { logger.Debug("authentication", "user", conn.User(), "method", method, "err", err) diff --git a/pkg/ssh/ui.go b/pkg/ssh/ui.go index 4b84542c4..7394937c7 100644 --- a/pkg/ssh/ui.go +++ b/pkg/ssh/ui.go @@ -204,8 +204,11 @@ func (ui *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { ui.showFooter = true } case tea.MouseMsg: - switch msg.Type { - case tea.MouseLeft: + if msg.Action != tea.MouseActionPress { + break + } + switch msg.Button { + case tea.MouseButtonLeft: switch { case ui.common.Zone.Get("footer").InBounds(msg): cmds = append(cmds, footer.ToggleFooterCmd) diff --git a/pkg/ui/components/selector/selector.go b/pkg/ui/components/selector/selector.go index 7454cc3e7..72239d408 100644 --- a/pkg/ui/components/selector/selector.go +++ b/pkg/ui/components/selector/selector.go @@ -231,12 +231,15 @@ func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds := make([]tea.Cmd, 0) switch msg := msg.(type) { case tea.MouseMsg: - switch msg.Type { - case tea.MouseWheelUp: + if msg.Action != tea.MouseActionPress { + break + } + switch msg.Button { + case tea.MouseButtonWheelUp: s.CursorUp() - case tea.MouseWheelDown: + case tea.MouseButtonWheelDown: s.CursorDown() - case tea.MouseLeft: + case tea.MouseButtonLeft: curIdx := s.Index() for i, item := range s.Items() { item, _ := item.(IdentifiableItem) diff --git a/pkg/ui/components/tabs/tabs.go b/pkg/ui/components/tabs/tabs.go index ac3a78072..81dbf8709 100644 --- a/pkg/ui/components/tabs/tabs.go +++ b/pkg/ui/components/tabs/tabs.go @@ -64,7 +64,11 @@ func (t *Tabs) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds = append(cmds, t.activeTabCmd) } case tea.MouseMsg: - if msg.Type == tea.MouseLeft { + if msg.Action != tea.MouseActionPress { + break + } + switch msg.Button { + case tea.MouseButtonLeft: for i, tab := range t.tabs { if t.common.Zone.Get(tab).InBounds(msg) { t.activeTab = i diff --git a/pkg/ui/pages/repo/repo.go b/pkg/ui/pages/repo/repo.go index 5d4105bf6..8ae3b3e1a 100644 --- a/pkg/ui/pages/repo/repo.go +++ b/pkg/ui/pages/repo/repo.go @@ -186,13 +186,16 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } switch msg := msg.(type) { case tea.MouseMsg: - switch msg.Type { - case tea.MouseLeft: + if msg.Action != tea.MouseActionPress { + break + } + switch msg.Button { + case tea.MouseButtonLeft: switch { case r.common.Zone.Get("repo-help").InBounds(msg): cmds = append(cmds, footer.ToggleFooterCmd) } - case tea.MouseRight: + case tea.MouseButtonRight: switch { case r.common.Zone.Get("repo-main").InBounds(msg): cmds = append(cmds, goBackCmd)