mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 09:22:42 +03:00
097032327d
Adds the ability to have some effect run when a selection changes in a picker. If the `PickerDelegate` implements something other than `None` for `selected_index_changed` then each time the selection changes it will run that effect. For example: ```rs impl PickerDelegate for PromptManagerDelegate { //... fn selected_index_changed( &self, ix: usize, cx: &mut ViewContext<Picker<Self>>, ) -> Option<Box<dyn Fn(&mut WindowContext) + 'static>> { Some(self.prompt_manager.set_active_prompt(ix, cx)) } //... } ``` This isn't currently used in any picker, but I'm adding this to allow the functionality we intended for the prompt library, we're changing selections, activates a preview in the right column. This will be useful for building any sort of UI where there's a picker on the left and a preview on the right, such as a UI like them telescope. Release Notes: - N/A |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE-GPL |