# Fix terminal path detection inside parentheses \(\#52222\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d5fd199719d744cec7f4b3772d42204b914d8113)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d5fd199719d744cec7f4b3772d42204b914d8113

Requested commit: d5fd199719d744cec7f4b3772d42204b914d8113

Commit: d5fd199719d744cec7f4b3772d42204b914d8113

Tree: ab259abf44a36c5da920f5887fa70c4d5906dfa7

Author: Mikhail Butvin

Committer: GitHub

## Message

```
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>
```

## Parents

- [7db7ea9277e6a2bffa7c7cabc7bf7791012778a7](https://git.cafe/gitcafe/zed/commit/7db7ea9277e6a2bffa7c7cabc7bf7791012778a7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d5fd199719d744cec7f4b3772d42204b914d8113?format=markdown)
