zed/crates/terminal
Mikhail Butvin d5fd199719
Fix terminal path detection inside parentheses (#52222)
## Summary

Paths inside parentheses without a preceding space (e.g.
`Update(.claude/skills/sandbox/SKILL.md)` or `Write(/test/cool.rs)` from
Claude Code output) were not clickable in the terminal. The `(`
character was allowed as a middle character in the default path
hyperlink regex, causing the entire `Update(.path/here` to be matched as
a single invalid path.

**Changes:**

- Remove `(` from the middle-chars alternation (`[:(]` → `:`) in the
default path hyperlink regex, so `(` always acts as a path boundary —
consistent with it already being excluded from first and last character
sets. Preserves upstream's space exclusion after `:`.
- Iterate all regex matches in the line instead of only the first, so
the correct path (which may be the second match after a prefix like
`Update`) is found. This also simplifies the code by removing the
separate hovered-word search logic.

**Known tradeoff:**

Filenames with parentheses in the middle (e.g.
`docker-compose.prod(copy).yml`) are no longer matched as a single path.
This is uncommon in terminal output contexts (compiler errors, stack
traces, tool output) and is documented with a `should_panic` test.

**What doesn't break:**

- `(/path/file.js:321:13)` — `(` at word start is excluded by the
first-char rule (unchanged)
- Node.js stack traces like `at fn (/path/file.js:10:5)` — space before
`(` makes it a separate word
- All 38 terminal hyperlink tests pass

Related: #18556, #23774

Release Notes:

- Fixed terminal path detection for paths inside parentheses without
preceding space (e.g. `Update(path)` or `Write(path)` patterns from CLI
tool output)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-21 08:11:30 +00:00
..
src Fix terminal path detection inside parentheses (#52222) 2026-04-21 08:11:30 +00:00
Cargo.toml theme: Split out theme_settings crate (#52569) 2026-03-27 14:41:25 +01:00
LICENSE-GPL chore: Change AGPL-licensed crates to GPL (except for collab) (#4231) 2024-01-24 00:26:58 +01:00