Skip to content

Add mouse support to TUI: click to select, drag to copy, scroll wheel#2705

Draft
domenkozar wants to merge 1 commit into
mainfrom
tui-mouse-support
Draft

Add mouse support to TUI: click to select, drag to copy, scroll wheel#2705
domenkozar wants to merge 1 commit into
mainfrom
tui-mouse-support

Conversation

@domenkozar

Copy link
Copy Markdown
Member

Enable mouse capture for process views (up/processes up). Supports double click to expand an activity, drag to select and copy activity names via OSC 52, and scroll wheel navigation.

It has a bug of calculating y axis wrong.

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

🔍 Suggested Reviewers

Based on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:

  • @sandydoo - 64.4% of changed lines (29 lines)
  • @sadjow - 35.6% of changed lines (16 lines)

Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏

This comment was automatically generated by git-blame-auto-reviewer

Last updated: 2026-04-08T09:41:50.203Z

Comment thread devenv-tui/src/app.rs
if is_double_click {
*last_click.write() = None;
if let Ok(mut ui) = ui_state.write() {
ui.selected_activity = Some(activity_id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This branch never switches to ViewMode::ExpandedLogs, so a double-click only selects the activity instead of expanding it. It also means the first click never selects anything, because selected_activity is only written in the double-click path.

Comment thread devenv-tui/src/app.rs Outdated
}
}
}
MouseEventKind::ScrollDown | MouseEventKind::ScrollUp => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this wheel handler duplicates ScrollView's own mouse scrolling. view() already wraps the activity list in ScrollView, and iocraft handles ScrollUp/ScrollDown there, so each wheel tick over the list should scroll twice.

Comment thread devenv-tui/src/app.rs Outdated
let canvas_height = activity_area_height + SUMMARY_BAR_HEIGHT as i32;
// Canvas starts at initial_cursor_row, but if it would overflow the
// terminal, the terminal scrolls so canvas_bottom = terminal_height - 1.
let canvas_top = (initial_cursor_row as i32).min(terminal_height as i32 - canvas_height);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think terminal-level canvas_top math is valid here. use_terminal_events rewrites FullscreenMouse coordinates into the component's local coordinate system before MainView sees them, so subtracting initial_cursor_row / canvas_top again shifts hit testing and drag selection.

Enable mouse capture for process views (up/processes up). Supports
double click to expand an activity, drag to select and copy activity
names via OSC 52, and scroll wheel navigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 8, 2026

Copy link
Copy Markdown

Deploying devenv with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4950713
Status: ✅  Deploy successful!
Preview URL: https://f0df531f.devenv.pages.dev
Branch Preview URL: https://tui-mouse-support.devenv.pages.dev

View logs

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.

2 participants