feat: Add double-click to set default device#36
Open
prabhanshu11 wants to merge 3 commits intotsowell:mainfrom
Open
feat: Add double-click to set default device#36prabhanshu11 wants to merge 3 commits intotsowell:mainfrom
prabhanshu11 wants to merge 3 commits intotsowell:mainfrom
Conversation
Adds the core infrastructure for double-click detection on mouse events. When enabled via config, double-clicking (within 400ms, 2px tolerance) on a device triggers the same actions as right-click - setting it as default. Implementation: - Added `last_click` field to App struct for click tracking - Added `double_click_select` config option (defaults to false) - Modified MouseEvent handler to detect double-clicks - On double-click, lookup and execute right-click actions The feature is disabled by default and can be enabled via config file with `double_click_select = true`.
Adds comprehensive unit tests for the double-click detection feature: - single_click_stores_position: verifies click tracking works - double_click_within_threshold_resets_tracking: confirms double-click detection - clicks_outside_time_threshold_not_double_click: 400ms timeout works - clicks_outside_position_threshold_not_double_click: position tolerance works - clicks_within_position_tolerance_is_double_click: 2px tolerance accepted - after_double_click_next_click_starts_fresh: prevents triple-click issues Also updates wiremix.toml to document the double_click_select option.
Adds a command-line flag to enable the double-click feature at runtime. The feature remains disabled by default and can be enabled via: 1. CLI flag: wiremix --double-click-select 2. Config file: double_click_select = true This makes the feature opt-in as requested, allowing users to explicitly enable it if they prefer double-click behavior over right-click.
9b8c949 to
195d32d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements double-click detection for mouse events as an opt-in feature. When enabled, double-clicking on a device triggers the same actions as right-click - selecting the object and setting it as default.
This improves mouse-driven workflows where users expect click-to-select behavior common in other TUI applications.
Commits
Implementation
last_clickfield to App struct for click trackingdouble_click_selectconfig option (defaults to false)MouseEvent::handleto detect double-clicks (within 400ms, 2px tolerance)--double-click-selectCLI flag for runtime enableUsage
Tests
6 new tests covering:
single_click_stores_position: verifies click tracking worksdouble_click_within_threshold_resets_tracking: confirms double-click detectionclicks_outside_time_threshold_not_double_click: 400ms timeout worksclicks_outside_position_threshold_not_double_click: position tolerance worksclicks_within_position_tolerance_is_double_click: 2px tolerance acceptedafter_double_click_next_click_starts_fresh: prevents triple-click issuesAll 78 tests pass.
Closes #35