Skip to content

feat(tui): add mouse interaction and click handling#6

Merged
HanSoBored merged 12 commits intomainfrom
feat/tui-mouse-interaction
Apr 24, 2026
Merged

feat(tui): add mouse interaction and click handling#6
HanSoBored merged 12 commits intomainfrom
feat/tui-mouse-interaction

Conversation

@HanSoBored
Copy link
Copy Markdown
Collaborator

Summary

  • Add mouse click support to TUI with hit-test click regions
  • Add vertical scrollbar with page up/down click areas
  • Make TUI the default output mode with --cli shorthand flag
  • Add footer scroll regions (stacked vertically)
  • Remove invisible header tab click regions (tabs toggled via keyboard)

Changes

Commit Description
feat(cli) Add --cli flag, make TUI default output
feat(tui) Add mouse click handling system (ClickRegions, ClickAction)
feat(tui) Integrate mouse events into runner event loop
feat(tui) Add click regions and scrollbar to widgets
fix(tui) Use BLUE color for block title style
docs(readme) Update documentation with TUI screenshot
chore Update Cargo.lock and add docs directory

Verification

  • Clippy (-D warnings): ✅ Pass
  • Tests: ✅ Pass (15/15)

- Change default output from Text to Tui
- Add --cli shorthand flag for text output
- Add get_output_mode() helper method
- Add comprehensive CLI tests for new flag combinations
- Add mouse.rs module with ClickRegions, ClickAction, HeaderTab, ScrollDirection
- Add Copy derive to AppView and HeaderTab enums
- Add on_mouse_click() and related handlers to AppState
- Register mouse module in tui/mod.rs
- Add MouseEventKind import and mouse event handling
- Use RefCell to collect click regions during render
- Dispatch mouse events to handle_mouse_event()
- Simplify restore_logs() with unwrap_or_else
- Drop write guard before event::poll() to avoid blocking
- Update render signatures to accept and return ClickRegions
- Add row-level click detection in symbol_table
- Add scrollbar track click regions (page up/down)
- Add footer scroll regions stacked vertically
- Remove invisible header tab click regions
- Add vertical scrollbar with custom styling to symbol table
- Change themed_block title style from TAG to BLUE for consistency
- Add TUI image with proper markdown syntax
- Update usage examples for new default TUI mode
- Add --cli flag documentation
- Remove architecture diagram and project structure
- Simplify and reorganize sections
- Bump version to 0.2.0 in Cargo.lock
- Add docs/image/TUI.png screenshot
Copy link
Copy Markdown
Collaborator Author

@HanSoBored HanSoBored left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Extract build_table_rows() for header + data row construction
- Extract add_click_regions() for row + scrollbar click detection
- Extract render_scrollbar() for scrollbar state + rendering
- Extract chrome variable for content height calculation
- Reduce main render() from ~65 lines to orchestrator pattern
- Add HeaderTab/ScrollDirection imports to eliminate qualified paths
- Simplify on_header_tab_click from nested match to direct assignment
- Split long crossterm import into two lines
- Add RefCell justification comment for render closure
- Add CyberdeckTheme::footer_item_style() to eliminate 4x repeated style
- Extract scroll_y/scroll_h variables to fix 124-char line
- Remove obsolete header tab click regions comment
Copy link
Copy Markdown
Collaborator Author

@HanSoBored HanSoBored left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Review — ✅ PASS

All code quality issues from the initial analysis have been addressed:

Fixes Applied

Principle Issue Status
SRP symbol_table::render() split into 3 focused functions ✅ Fixed
DRY Repeated footer styles extracted to footer_item_style() ✅ Fixed
DRY Fully qualified paths replaced with imports in app.rs ✅ Fixed
KISS on_header_tab_click simplified from nested match to direct assignment ✅ Fixed
Comments RefCell usage documented with justification comment ✅ Fixed
Comments Obsolete header tab comment removed ✅ Fixed
Line Length 3 lines >100 chars fixed with variable extraction ✅ Fixed
Function Length symbol_table::render() reduced from ~65 to orchestrator pattern ✅ Fixed

Verification

  • Clippy (-D warnings): ✅ Pass
  • Tests: ✅ 15/15 Pass

Remaining Notes (Non-blocking)

  • build_table_rows (46 lines) and add_click_regions (47 lines) slightly over 30-line guideline
  • Duplicated layout constants (header_height, title_height, top_border) in two functions
  • Pre-existing long functions (runner.rs::run, footer.rs::render) — out of scope for this PR

Recommendation: Ready to merge. 🚀

- Add module-level constants: HEADER_HEIGHT, TITLE_HEIGHT, TOP_BORDER
- Extract row_style() helper to eliminate duplicated style construction
- Extract add_row_click_regions() and add_scrollbar_click_regions() helpers
- Reduce add_click_regions() to 8-line orchestrator
- Reduce build_table_rows() from 46 to 31 lines
- Remove unused HIGHLIGHT_BG constant from theme.rs
- Fix indentation in runner.rs RefCell comment
- Reformat function signatures in footer.rs and header.rs
- Break long Rect::new calls across multiple lines in footer.rs
Copy link
Copy Markdown
Collaborator Author

@HanSoBored HanSoBored left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge!

@HanSoBored HanSoBored merged commit 8adc9ab into main Apr 24, 2026
3 checks passed
@HanSoBored HanSoBored deleted the feat/tui-mouse-interaction branch April 24, 2026 16:06
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