Skip to content

feat(mouse): triple-click selects the whole line#80

Merged
roramirez merged 1 commit into
mainfrom
feat/triple-click-line-select
Jul 18, 2026
Merged

feat(mouse): triple-click selects the whole line#80
roramirez merged 1 commit into
mainfrom
feat/triple-click-line-select

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

Adds triple-click line selection. Today double-click selects a word; a third rapid click now selects the entire line under the cursor, leaves it highlighted in anchored Visual mode, and copies it to the clipboard — mirroring the existing double-click copy behavior.

Changes

  • src/app_state.rs: last_click now carries a running click count (Option<(Instant, f64, f64, u8)>). New AppState::click_count returns 1/2/3 within the 400 ms / 4 px window (a 4th rapid click cycles back to a fresh single; a press outside the window resets to 1).
  • src/app_event.rs: replaced is_double_click with a click_count-driven dispatch in handle_selection_click — 3 → line select, 2 → word select, 1 → start drag selection.
  • src/input/mouse_ops.rs: new select_line_at that anchors a full-row Visual selection (start_col = 0, cur_col = cols-1) and copies it.
  • CHANGELOG.md: entry under [Unreleased] → Added.
  • Tests: click-count helper (single/double/triple/wrap/timing/distance) and select_line_at producing a full-row anchored Visual selection.

How to test

  • cargo test — new tests: click_count_* in src/app_state_test.rs and select_line_at_* in src/input/mouse_ops_test.rs.
  • Manual: triple-click a line of terminal output — the whole line highlights and is copied to the clipboard; double-click still selects a word; single-click-drag still selects a range.

Extend the click tracker to carry a running click count so a third
rapid press within the 400 ms / 4 px window is detected. Triple-click
selects the entire line under the cursor, leaves it highlighted in
anchored Visual mode, and copies it to the clipboard, mirroring the
existing double-click word behavior.
@roramirez
roramirez force-pushed the feat/triple-click-line-select branch from 71edbff to e4aec93 Compare July 18, 2026 21:12
@roramirez
roramirez merged commit c98c257 into main Jul 18, 2026
2 checks passed
@roramirez
roramirez deleted the feat/triple-click-line-select branch July 18, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant