Skip to content

bug: Add Project buttons have incorrect mouse hitboxes when dialog content wraps #616

Description

@shumkov

Summary

In the Add Project file picker, the visible Add as project and Cancel buttons do not respond to mouse clicks at their rendered positions for some longer paths/window layouts.

Folder navigation works, and the selected directory is a valid Git repository. The action buttons work only when clicking a terminal row above their visible location (or by using a keyboard/manual registry workaround).

Environment

  • amux: 0.0.19 (Homebrew formula andyrewlee/amux/amux)
  • macOS: 26.5.1 (25F80)
  • tmux: 3.7b
  • theme: catppuccin

Steps to reproduce

  1. Run amux.
  2. Open Add Project.
  3. Navigate to a repository with a sufficiently long path, for example:
    /Users/ivanshumkov/Projects/shumkov/umi-store-theme
  4. Click the visible Add as project button.
  5. Click the visible Cancel button.

Expected behavior

Each button responds when clicked at its rendered position.

Actual behavior

Neither visible button responds. The dialog stays open and no dialog result is logged for those clicks. Clicking approximately one terminal row above the rendered button can activate it.

The current path visibly wraps in the dialog, which appears to shift the displayed buttons down without shifting their mouse hit regions.

Likely cause

This looks like a mismatch between rendered height and hit-test coordinates in the file picker:

  • renderLines() records button hit regions using logical slice indexes and sets lastContentHeight = len(lines).
  • dialogBounds() and Update(tea.MouseClickMsg) use that logical height/index for hit testing.
  • Lipgloss can render/wrap a logical line to more than one terminal row at the final dialog width.
  • The visible controls then move down, but buttonHits retain their pre-wrap Y positions.

The screenshot reproduction showed the current path split across two terminal rows immediately above the input/list.

The existing button tests derive click coordinates from buttonHits and dialogBounds(lastContentHeight), so they verify the internal coordinate model but may not catch a mismatch with the final rendered output. A regression test using the final rendered row positions at a narrow width/long path may expose it.

Relevant files:

  • internal/ui/common/filepicker_render.go
  • internal/ui/common/filepicker.go
  • internal/ui/common/filepicker_button_test.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions