# tab_switcher: Select first buffer in the list when a query is enabled \(\#58424\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 03d4536836ef8686e428895cc0e07b5231670efd

Requested commit: 03d4536836ef8686e428895cc0e07b5231670efd

Commit: 03d4536836ef8686e428895cc0e07b5231670efd

Tree: 20353b220c9410833ffab2558400834ba0e4c9a4

Author: Roméo Maignal

Committer: GitHub

## Message

```
tab_switcher: Select first buffer in the list when a query is enabled (#58424)

…tered (#58420)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #58420

Release Notes:
- Reset `selected_index` to 0 whenever the query goes from empty to
non-empty, ensuring the first (best) fuzzy match is always highlighted
when the user starts typing.
- This is handled in `update_matches()` and `update_all_pane_matches()`
by checking whether the query is empty before applying the reset.
```

## Parents

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

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