From 1784f3f28b58bd3303e5605228d029aebc5d22dd Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 25 Oct 2024 11:46:44 +0000 Subject: [PATCH] chore(deps): update rust crate tui-scrollview to 0.5 revert: reneable ScrollView --- Cargo.lock | 64 ++----------------- Cargo.toml | 2 +- .../cli/src/tui/components/configured_app.rs | 21 ++++-- 3 files changed, 22 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d0439c..9a3319f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1121,9 +1121,9 @@ dependencies = [ "notify", "pretty_assertions", "rand", - "ratatui 0.29.0", + "ratatui", "regex", - "rstest 0.23.0", + "rstest", "secrecy 0.10.3", "sendmail", "serde_json", @@ -3374,26 +3374,6 @@ dependencies = [ "getrandom 0.2.15", ] -[[package]] -name = "ratatui" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdef7f9be5c0122f890d58bdf4d964349ba6a6161f705907526d891efabba57d" -dependencies = [ - "bitflags 2.6.0", - "cassowary", - "compact_str", - "instability", - "itertools", - "lru", - "paste", - "strum 0.26.3", - "strum_macros 0.26.4", - "unicode-segmentation", - "unicode-truncate", - "unicode-width 0.1.13", -] - [[package]] name = "ratatui" version = "0.29.0" @@ -3566,18 +3546,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rstest" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b423f0e62bdd61734b67cd21ff50871dfaeb9cc74f869dcd6af974fbcb19936" -dependencies = [ - "futures", - "futures-timer", - "rstest_macros 0.22.0", - "rustc_version", -] - [[package]] name = "rstest" version = "0.23.0" @@ -3586,28 +3554,10 @@ checksum = "0a2c585be59b6b5dd66a9d2084aa1d8bd52fbdb806eafdeffb52791147862035" dependencies = [ "futures", "futures-timer", - "rstest_macros 0.23.0", + "rstest_macros", "rustc_version", ] -[[package]] -name = "rstest_macros" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e1711e7d14f74b12a58411c542185ef7fb7f2e7f8ee6e2940a883628522b42" -dependencies = [ - "cfg-if", - "glob", - "proc-macro-crate", - "proc-macro2", - "quote", - "regex", - "relative-path", - "rustc_version", - "syn 2.0.82", - "unicode-ident", -] - [[package]] name = "rstest_macros" version = "0.23.0" @@ -4447,13 +4397,13 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tui-scrollview" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27a65189ac0c5f8af32660c453a1babae3ac7e72791b9dbeb1221073569f44ea" +checksum = "235ee99b9af57bc0bc8cf42604f5868641690ed652001120d63ca2784a41c3d3" dependencies = [ "indoc", - "ratatui 0.28.1", - "rstest 0.22.0", + "ratatui", + "rstest", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 948016d..71c8d33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ ratatui = "0.29" directories = "5.0" lazy_static = "1.5" color-eyre = "0.6" -tui-scrollview = "0.4" +tui-scrollview = "0.5" regex = "1.10" chrono = "0.4" diff --git a/crates/cli/src/tui/components/configured_app.rs b/crates/cli/src/tui/components/configured_app.rs index 6659655..114a161 100644 --- a/crates/cli/src/tui/components/configured_app.rs +++ b/crates/cli/src/tui/components/configured_app.rs @@ -1,13 +1,12 @@ -// use std::collections::BTreeMap; use git_next_core::ForgeAlias; use ratatui::{ buffer::Buffer, - layout::{Direction, Layout, Rect}, - widgets::{StatefulWidget, Widget}, + layout::{Direction, Layout, Rect, Size}, + widgets::StatefulWidget, }; -use tui_scrollview::ScrollViewState; +use tui_scrollview::{ScrollView, ScrollViewState}; use crate::tui::actor::ForgeState; @@ -28,10 +27,16 @@ impl<'a> HeightContraintLength for ConfiguredAppWidget<'a> { impl<'a> StatefulWidget for ConfiguredAppWidget<'a> { type State = ScrollViewState; - fn render(self, area: Rect, buf: &mut Buffer, _state: &mut Self::State) + fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) where Self: Sized, { + let height = self + .children() + .iter() + .map(HeightContraintLength::height_constraint_length) + .sum::(); + let mut scroll = ScrollView::new(Size::new(area.width - 1, height)); let layout_forge_list = Layout::default() .direction(Direction::Vertical) .constraints( @@ -39,12 +44,14 @@ impl<'a> StatefulWidget for ConfiguredAppWidget<'a> { .iter() .map(HeightContraintLength::height_constraint_length), ) - .split(area); + .split(scroll.area()); self.children() .into_iter() .enumerate() - .for_each(|(i, w)| w.render(layout_forge_list[i], buf)); + .for_each(|(i, w)| scroll.render_widget(w, layout_forge_list[i])); + + scroll.render(area, buf, state); } } impl<'a> ConfiguredAppWidget<'a> {