feat(file-manager): handle the wheel, double clicks and right clicks #57

Merged
BlackAngelTV merged 2 commits from feat/file-manager-mouse into main 2026-12-03 10:23:11 +01:00
Owner

Summary

on_mouse_event only handled MOUSE_CLICK (row selection) and MOUSE_MOVE (pointer shape); everything else was keyboard-only, so the wheel, double clicks and right clicks did nothing in the panel.

The panel now handles:

  • Wheel: one notch moves the selection by three rows, which scrolls the list (move_selection keeps the selected row visible). The event is consumed by the panel and never reaches the terminal hosting the dock.
  • Double click: a second click on the same row within 500 ms (kitty's click_interval default) runs activate(), i.e. opens the directory in the panel or the file in the editor, exactly like Enter.
  • Right click: selects the clicked row and opens the action palette, the same one :: opens.

Wheel notches arrive as MOUSE_PRESS with MOUSE_WHEEL_UP/DOWN, the same way the diff kitten handles them. Clicks and wheel events are ignored while the palette is open so they cannot change the selection behind it.

Changes

  • kittens/file_manager/main.go: wheel, double-click tracking (click_tracker) and right-click context menu.
  • kittens/file_manager/main_test.go: hit-test with a scrolled list (including a scroll past the end) and double-click detection.
  • docs/kittens/file-manager.rst, docs/changelog.rst: mouse section and changelog entry.

Tests

  • go test ./kittens/file_manager/
  • gofmt on the touched files

The interactions were not exercised in a running terminal: the tests cover the row hit-test with scroll and the click tracker, not the rendered panel.

Fixes #47

## Summary `on_mouse_event` only handled `MOUSE_CLICK` (row selection) and `MOUSE_MOVE` (pointer shape); everything else was keyboard-only, so the wheel, double clicks and right clicks did nothing in the panel. The panel now handles: - **Wheel**: one notch moves the selection by three rows, which scrolls the list (`move_selection` keeps the selected row visible). The event is consumed by the panel and never reaches the terminal hosting the dock. - **Double click**: a second click on the same row within 500 ms (kitty's `click_interval` default) runs `activate()`, i.e. opens the directory in the panel or the file in the editor, exactly like `Enter`. - **Right click**: selects the clicked row and opens the action palette, the same one `::` opens. Wheel notches arrive as `MOUSE_PRESS` with `MOUSE_WHEEL_UP`/`DOWN`, the same way the diff kitten handles them. Clicks and wheel events are ignored while the palette is open so they cannot change the selection behind it. ## Changes - `kittens/file_manager/main.go`: wheel, double-click tracking (`click_tracker`) and right-click context menu. - `kittens/file_manager/main_test.go`: hit-test with a scrolled list (including a scroll past the end) and double-click detection. - `docs/kittens/file-manager.rst`, `docs/changelog.rst`: mouse section and changelog entry. ## Tests - `go test ./kittens/file_manager/` - `gofmt` on the touched files The interactions were not exercised in a running terminal: the tests cover the row hit-test with scroll and the click tracker, not the rendered panel. Fixes #47
BlackAngelTV added 2 commits 2026-12-03 10:23:09 +01:00
The panel only reacted to a left click on a row, so every other gesture was
keyboard-only: the wheel did nothing, a double click did not open the entry and
there was no way to reach the actions from the pointer. The wheel now steps the
selection by three rows without leaking the event to the hosting terminal, a
second click on the same row within kitty's click interval runs the primary
action, and a right click opens the action palette on the clicked row.

Fixes #47
chore(release): bump the fork version to 0.1.15
CI / check (pull_request) Successful in 3m55s
e1cce67221
The file manager gained mouse support, so cut a patch release. All the version
copies must agree for the packaging workflow.
BlackAngelTV merged commit 1b9e076139 into main 2026-12-03 10:23:11 +01:00
BlackAngelTV deleted branch feat/file-manager-mouse 2026-12-03 10:23:11 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FWS/FWS-Kitty#57