From a549171c4047e8c4c50888ec59937b151840ec9c Mon Sep 17 00:00:00 2001 From: bbrabbitt Date: Fri, 15 Jul 2022 21:39:59 -0700 Subject: [PATCH] fix plugin panel scroll bar fix clippy and fmt warnings code cleanup --- lapce-ui/src/plugin.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lapce-ui/src/plugin.rs b/lapce-ui/src/plugin.rs index deb64ba2..6dfeeec5 100644 --- a/lapce-ui/src/plugin.rs +++ b/lapce-ui/src/plugin.rs @@ -1,3 +1,4 @@ +use crate::scroll::LapceScroll; use druid::{ piet::{Text, TextAttribute, TextLayout as PietTextLayout, TextLayoutBuilder}, BoxConstraints, Color, Cursor, Env, Event, EventCtx, FontWeight, LayoutCtx, @@ -32,7 +33,12 @@ pub fn new_panel(data: &LapceTabData) -> LapcePanel { PanelKind::Plugin, data.plugin.widget_id, split_id, - vec![(split_id, PanelHeaderKind::None, Self::new().boxed(), None)], + vec![( + split_id, + PanelHeaderKind::None, + LapceScroll::new(Self::new()).boxed(), + None, + )], ) } @@ -141,7 +147,13 @@ fn layout( _data: &LapceTabData, _env: &Env, ) -> Size { - bc.max() + if _data.plugins.is_empty() { + return bc.max(); + } + let height = 3.0 * self.line_height * _data.plugins.len() as f64; + let height = height.max(bc.max().height); + + Size::new(bc.max().width, height) } fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {