on master help sign in
DynamicPicker: Reset idle timeout on refresh

If the new results shown by the picker select a file that hasn't been previewed before, the idle timeout would not trigger highlighting on that file. With this change, we reset the idle timeout and allow that file to be highlighted on the next idle timeout event.

commit35cf972ce459eda6ceffb7a7c256a4bc9f4e6e39 authorMichael Davis <mcarsondavis@gmail.com> dateWed 7 Dec 2022, 16:24 (4 years ago) parenta7daa02
1 file changed+2−1
helix-term/src/ui/picker.rs+2−1
helix-term/src/ui/picker.rs+2−1
@@ -798,7 +798,7 @@ impl<T: Item + Send + 'static> Component for DynamicPicker<T> {
798798 cx.jobs.callback(async move {
799799 let new_options = new_options.await?;
800800 let callback =
801− crate::job::Callback::EditorCompositor(Box::new(move |_editor, compositor| {
801+ crate::job::Callback::EditorCompositor(Box::new(move |editor, compositor| {
802802 // Wrapping of pickers in overlay is done outside the picker code,
803803 // so this is fragile and will break if wrapped in some other widget.
804804 let picker = match compositor.find_id::<Overlay<DynamicPicker<T>>>(Self::ID) {
@@ -808,6 +808,7 @@ impl<T: Item + Send + 'static> Component for DynamicPicker<T> {
808808 picker.options = new_options;
809809 picker.cursor = 0;
810810 picker.force_score();
811+ editor.reset_idle_timer();
811812 }));
812813 anyhow::Ok(callback)
813814 });