# Refactor file_finder send element open code \(\#7210\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 0102ffbfcab7fd6f74474e46b8e8b1746daa1041

Requested commit: 0102ffbfcab7fd6f74474e46b8e8b1746daa1041

Commit: 0102ffbfcab7fd6f74474e46b8e8b1746daa1041

Tree: 5825fce299bcfb6a161e8d66fcb3e65d814ce2ab

Author: Kirill Bulatov

Committer: GitHub

## Message

```
Refactor file_finder send element open code (#7210)

Follow-up of https://github.com/zed-industries/zed/pull/6947 (cc
@alygin) that fixes a few style nits and refactors the code around:
* use already stored `currently_opened_path` to decide what to do with
the history item sorting
* use the same method to set history items, encapsulate the bubbling up
logic there
* ensure history elements are properly sorted before populating

The main reason to change all that is the new comparator in the previous
version:
https://github.com/zed-industries/zed/pull/6947/files#diff-eac7c8c99856f77cee39117708cd1467fd5bbc8805da2564f851951638020842R234
that almost violated `util::extend_sorted` contract, requiring both
collections to be sorted the same way as the comparator would be: it did
work, because we bubbled currently open item up in the history items
list manually, and that we have only one such item.

Release Notes:
- N/A
```

## Parents

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

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