From 2f3af71408b20d064b5abcc3eadc730938e66bc7 Mon Sep 17 00:00:00 2001 From: remique <44347542+remique@users.noreply.github.com> Date: Thu, 12 Nov 2020 15:39:50 +0100 Subject: [PATCH] Add scrollbar in branchlist (#417) * Add scrollbar in branchlist * Change scrollbar symbol to DOUBLE_VERTICAL --- src/components/select_branch.rs | 12 ++++++++++-- src/ui/scrollbar.rs | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/select_branch.rs b/src/components/select_branch.rs index 297aab5c..0995cfde 100644 --- a/src/components/select_branch.rs +++ b/src/components/select_branch.rs @@ -78,12 +78,20 @@ impl DrawableComponent for SelectBranchComponent { .block( Block::default() .title(strings::SELECT_BRANCH_POPUP_MSG) - .borders(Borders::ALL) - .border_type(BorderType::Thick), + .border_type(BorderType::Thick) + .borders(Borders::ALL), ) .alignment(Alignment::Left), area, ); + + ui::draw_scrollbar( + f, + area, + &self.theme, + self.branch_names.len(), + self.scroll_top.get(), + ); } Ok(()) diff --git a/src/ui/scrollbar.rs b/src/ui/scrollbar.rs index 5cd63bd4..73f2ab9b 100644 --- a/src/ui/scrollbar.rs +++ b/src/ui/scrollbar.rs @@ -5,7 +5,7 @@ use tui::{ buffer::Buffer, layout::{Margin, Rect}, style::Style, - symbols::{block::FULL, line::THICK_VERTICAL}, + symbols::{block::FULL, line::DOUBLE_VERTICAL}, widgets::Widget, Frame, }; @@ -50,7 +50,7 @@ impl Widget for Scrollbar { } for y in area.top()..area.bottom() { - buf.set_string(right, y, THICK_VERTICAL, self.style_bar); + buf.set_string(right, y, DOUBLE_VERTICAL, self.style_bar); } let max_pos = self.lines.saturating_sub(area.height);