# Shorten overflowing paths in file finder \(\#25303\) · gitcafe/zed

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

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

Visibility: public

Requested revision: aba89ba12a09d42bbfcb722b102ededd1d6aa608

Requested commit: aba89ba12a09d42bbfcb722b102ededd1d6aa608

Commit: aba89ba12a09d42bbfcb722b102ededd1d6aa608

Tree: 9524758ca238d18a1f72a5bcd8a05fe8ee1dabc4

Author: Cole Miller

Committer: GitHub

## Message

```
Shorten overflowing paths in file finder (#25303)

Closes #7711

This PR changes the file finder to shorten the path portion of each
match by replacing a segment with `...`, if it would otherwise overflow
horizontally. Details:

- The overflow calculation is based on a crude linear width estimate for
ASCII text at the current em width. No elision is done for non-ASCII
paths.
- A path component will not be elided if it contains a matching position
for the file finder's search, or if it's the first or last component.
- Elision is only applied when it is successful in shortening the path
enough to not overflow.

Release Notes:

- Improved the appearance of the file finder when long paths are shown
by eliding path segments
```

## Parents

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

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