From 3b944bb947d5751ebdb15a44abc96342e9dcaa99 Mon Sep 17 00:00:00 2001 From: Em Zhan Date: Tue, 10 Jun 2025 08:44:23 -0500 Subject: [PATCH] Use existing `impl` for helper function --- helix-term/src/ui/picker.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 24487c426..360b000f6 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -985,6 +985,15 @@ impl Picker { ); } } + + fn get_layout(&self, area: Rect) -> (bool, bool) { + let render_preview = self.show_preview + && self.file_fn.is_some() + && area.width >= MIN_AREA_WIDTH_FOR_PREVIEW + && area.height >= MIN_AREA_HEIGHT_FOR_PREVIEW; + let stack_vertically = area.width / 2 < MIN_AREA_WIDTH_FOR_PREVIEW; + (render_preview, stack_vertically) + } } impl Component for Picker { @@ -1009,7 +1018,7 @@ impl Component for Picker Component for Picker Drop for Picker { self.version.fetch_add(1, atomic::Ordering::Relaxed); } } -impl Picker { - fn get_picker_layout(&self, area: Rect) -> (bool, bool) { - let render_preview = self.show_preview - && self.file_fn.is_some() - && area.width >= MIN_AREA_WIDTH_FOR_PREVIEW - && area.height >= MIN_AREA_HEIGHT_FOR_PREVIEW; - let stack_vertically = area.width / 2 < MIN_AREA_WIDTH_FOR_PREVIEW; - (render_preview, stack_vertically) - } -} type PickerCallback = Box;