mirror of
https://github.com/zed-industries/zed.git
synced 2026-08-23 16:04:45 +00:00
# Objective - Fixes #54158 ## Solution - The root cause is in `FileFinderDelegate::set_selected_index`: it always sets `has_changed_selected_index = true`, regardless of whether the selection change was triggered by keyboard navigation or mouse hover. - Fix: Added a separate `set_hovered_index` hook to the `PickerDelegate` trait with a default implementation that delegates to `set_selected_index`. The hover handler in Picker now calls `set_hovered_index` instead of `set_selected_index`. FileFinderDelegate overrides `set_hovered_index` to update `selected_index` without setting `has_changed_selected_index`, so hover-triggered selection changes no longer interfere with the `Cmd+P` auto-confirm logic. ## Testing - Added `test_hover_does_not_set_has_changed_selected_index` in `file_finder_tests.rs` ## 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 adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed file finder auto-jumping to the wrong file when the mouse hovered over a different entry after pressing `Cmd+P` |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||