aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/picker.rs54
1 files changed, 27 insertions, 27 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 04ed940c..13746cfc 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -750,6 +750,33 @@ impl<T: Item + 'static> Picker<T> {
);
}
}
+}
+
+impl<T: Item + 'static> Component for Picker<T> {
+ fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
+ // +---------+ +---------+
+ // |prompt | |preview |
+ // +---------+ | |
+ // |picker | | |
+ // | | | |
+ // +---------+ +---------+
+
+ let render_preview = self.show_preview && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
+
+ let picker_width = if render_preview {
+ area.width / 2
+ } else {
+ area.width
+ };
+
+ let picker_area = area.with_width(picker_width);
+ self.render_picker(picker_area, surface, cx);
+
+ if render_preview {
+ let preview_area = area.clip_left(picker_width);
+ self.render_preview(preview_area, surface, cx);
+ }
+ }
fn handle_event(&mut self, event: &Event, ctx: &mut Context) -> EventResult {
if let Event::IdleTimeout = event {
@@ -846,33 +873,6 @@ impl<T: Item + 'static> Picker<T> {
}
}
-impl<T: Item + 'static> Component for Picker<T> {
- fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
- // +---------+ +---------+
- // |prompt | |preview |
- // +---------+ | |
- // |picker | | |
- // | | | |
- // +---------+ +---------+
-
- let render_preview = self.show_preview && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
-
- let picker_width = if render_preview {
- area.width / 2
- } else {
- area.width
- };
-
- let picker_area = area.with_width(picker_width);
- self.render_picker(picker_area, surface, cx);
-
- if render_preview {
- let preview_area = area.clip_left(picker_width);
- self.render_preview(preview_area, surface, cx);
- }
- }
-}
-
#[derive(PartialEq, Eq, Debug)]
struct PickerMatch {
score: i64,