Skip to content

Comments

feat(terminal): Sprint 2.3 - URL Recognition & Clicking#16

Merged
randlee merged 8 commits intodevelopfrom
feature/sprint-2-3-url-recognition
Jan 27, 2026
Merged

feat(terminal): Sprint 2.3 - URL Recognition & Clicking#16
randlee merged 8 commits intodevelopfrom
feature/sprint-2-3-url-recognition

Conversation

@randlee
Copy link
Owner

@randlee randlee commented Jan 26, 2026

Summary

Implements URL recognition and clicking functionality for TerminalG's terminal pane by leveraging Zed's existing hyperlink infrastructure.

Sprint 2.3 Phases Completed:

  • Phase 1: URL regex configuration
  • Phase 2: Mouse event wiring
  • Phase 3: Event handling for URL opening
  • Phase 4: Visual feedback (intentionally deferred to future sprint)

Key Changes

Phase 1: URL Regex Configuration

  • Added DEFAULT_PATH_REGEXES constant with file path patterns
  • Pass regex patterns to TerminalBuilder for URL detection

Phase 2: Mouse Event Wiring

  • Added handle_mouse_move(), handle_mouse_down(), handle_mouse_up() methods
  • Wire GPUI mouse events to Zed terminal handlers

Phase 3: Event Handling

  • Handle TerminalEvent::Open to launch URLs in browser via open crate
  • Handle TerminalEvent::NewNavigationTarget for hover state tracking

How It Works

  1. User holds Ctrl (Windows/Linux) or Cmd (macOS) and hovers over URL
  2. Zed's terminal detects URL via regex matching
  3. User clicks while holding modifier key
  4. TerminalEvent::Open is emitted
  5. URL opens in default browser via open::that()

Test plan

  • cargo test - 60/60 tests passing
  • cargo clippy -- -D warnings - clean
  • cargo build --release - success
  • Manual test: Ctrl/Cmd+click on https://example.com opens browser
  • Manual test: Works with http://, https://, git://, ssh:// URLs

Design Document

See docs/sprints/phase-2-sprint-3-design.md for full architecture details.


🤖 Generated with Claude Code

randlee and others added 8 commits January 26, 2026 14:30
- Comprehensive architecture analysis of Zed's hyperlink system
- 4-phase implementation blueprint leveraging existing Zed code
- Data flow diagrams for mouse events and URL opening
- Testing plan and risk assessment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Align code snippets with per-workspace terminal architecture
- Add warning about noisy path regexes
- Clarify modifier key handling (Cmd on macOS, Ctrl on Windows/Linux)
- Update hover state clearing logic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 1 of Sprint 2.3 - URL Recognition & Clicking
- Add DEFAULT_PATH_REGEXES constant with file path patterns
- Pass regex patterns to TerminalBuilder for URL detection
- Zed's terminal crate handles the actual regex matching

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 2 & 3 of Sprint 2.3 - URL Recognition & Clicking

Mouse event wiring (Phase 2):
- Add handle_mouse_move, handle_mouse_down, handle_mouse_up methods
- Wire GPUI mouse events to Zed terminal handlers
- Forward events for hyperlink detection and click handling

Event handling (Phase 3):
- Handle TerminalEvent::Open to launch URLs in browser
- Handle TerminalEvent::NewNavigationTarget for hover state
- Add open crate for cross-platform URL launching

Ctrl/Cmd+click on URLs now opens them in the default browser.
Zed's terminal crate handles URL detection internally.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix #1: CloseTerminal now closes correct tab by matching terminal entity
  instead of always removing active tab
- Fix #4: PathLike targets now open files with default app (line:col stripped)
- Fix #5: Subscriptions stored in TerminalTab, auto-dropped when tab removed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@randlee randlee merged commit 1990117 into develop Jan 27, 2026
5 checks passed
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