feat(tui): add mouse interaction and click handling#6
Merged
HanSoBored merged 12 commits intomainfrom Apr 24, 2026
Merged
Conversation
- 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
- 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
HanSoBored
commented
Apr 24, 2026
Collaborator
Author
HanSoBored
left a comment
There was a problem hiding this comment.
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) andadd_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
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
--clishorthand flagChanges
feat(cli)--cliflag, make TUI default outputfeat(tui)feat(tui)feat(tui)fix(tui)docs(readme)choreVerification
-D warnings): ✅ Pass