Compare commits

...

2 commits

Author SHA1 Message Date
Renovate Bot
d989da659c chore(deps): update rust crate ratatui to 0.29
All checks were successful
Rust / build (map[name:nightly]) (push) Successful in 6m57s
Rust / build (map[name:stable]) (push) Successful in 14m18s
Release Please / Release-plz (push) Successful in 1m50s
2024-10-22 07:32:53 +01:00
23de987444 fix: disable ScrollView
All checks were successful
Rust / build (map[name:nightly]) (push) Successful in 12m38s
Rust / build (map[name:stable]) (push) Successful in 13m3s
Release Please / Release-plz (push) Successful in 1m57s
Current version is incompatible with latest Ratatui. Backout this change
when compatibility is restore.
2024-10-22 07:31:08 +01:00
5 changed files with 51 additions and 39 deletions

36
Cargo.lock generated
View file

@ -1118,7 +1118,7 @@ dependencies = [
"notify", "notify",
"pretty_assertions", "pretty_assertions",
"rand", "rand",
"ratatui", "ratatui 0.29.0",
"regex", "regex",
"rstest 0.23.0", "rstest 0.23.0",
"secrecy 0.10.3", "secrecy 0.10.3",
@ -3352,7 +3352,6 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"cassowary", "cassowary",
"compact_str", "compact_str",
"crossterm",
"instability", "instability",
"itertools", "itertools",
"lru", "lru",
@ -3361,7 +3360,28 @@ dependencies = [
"strum_macros 0.26.4", "strum_macros 0.26.4",
"unicode-segmentation", "unicode-segmentation",
"unicode-truncate", "unicode-truncate",
"unicode-width", "unicode-width 0.1.13",
]
[[package]]
name = "ratatui"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
dependencies = [
"bitflags 2.6.0",
"cassowary",
"compact_str",
"crossterm",
"indoc",
"instability",
"itertools",
"lru",
"paste",
"strum 0.26.3",
"unicode-segmentation",
"unicode-truncate",
"unicode-width 0.2.0",
] ]
[[package]] [[package]]
@ -4401,7 +4421,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27a65189ac0c5f8af32660c453a1babae3ac7e72791b9dbeb1221073569f44ea" checksum = "27a65189ac0c5f8af32660c453a1babae3ac7e72791b9dbeb1221073569f44ea"
dependencies = [ dependencies = [
"indoc", "indoc",
"ratatui", "ratatui 0.28.1",
"rstest 0.22.0", "rstest 0.22.0",
] ]
@ -4500,7 +4520,7 @@ checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf"
dependencies = [ dependencies = [
"itertools", "itertools",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width 0.1.13",
] ]
[[package]] [[package]]
@ -4509,6 +4529,12 @@ version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
[[package]]
name = "unicode-width"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.5" version = "0.2.5"

View file

@ -27,7 +27,7 @@ git-next-forge-forgejo = { path = "crates/forge-forgejo", version = "0.13" }
git-next-forge-github = { path = "crates/forge-github", version = "0.13" } git-next-forge-github = { path = "crates/forge-github", version = "0.13" }
# TUI # TUI
ratatui = "0.28" ratatui = "0.29"
directories = "5.0" directories = "5.0"
lazy_static = "1.5" lazy_static = "1.5"
color-eyre = "0.6" color-eyre = "0.6"

View file

@ -5,10 +5,7 @@ use ratatui::{
style::{Color, Style, Stylize as _}, style::{Color, Style, Stylize as _},
symbols::border, symbols::border,
text::{Line, Span}, text::{Line, Span},
widgets::{ widgets::{Block, Paragraph, StatefulWidget, Widget},
block::{Position, Title},
Block, Paragraph, StatefulWidget, Widget,
},
}; };
use git_next_core::{ use git_next_core::{
@ -363,24 +360,19 @@ impl StatefulWidget for &State {
Self: Sized, Self: Sized,
{ {
let block = Block::bordered() let block = Block::bordered()
.title( .title_top(
Title::from(format!(" Git-Next v{} ", clap::crate_version!()).bold()) Line::from(format!(" Git-Next v{} ", clap::crate_version!()).bold())
.alignment(Alignment::Center), .alignment(Alignment::Center),
) )
.title( .title_bottom(
Title::from(Line::from(vec![ Line::from(vec![
" [q]uit ".into(), " [q]uit ".into(),
self.beating_heart().into(), self.beating_heart().into(),
" ".into(), " ".into(),
])) ])
.alignment(Alignment::Center) .alignment(Alignment::Center),
.position(Position::Bottom),
)
.title(
Title::from(format!(" {} ", time()))
.alignment(Alignment::Right)
.position(Position::Bottom),
) )
.title_bottom(Line::from(format!(" {} ", time())).alignment(Alignment::Right))
.border_set(border::THICK); .border_set(border::THICK);
let interior = block.inner(area); let interior = block.inner(area);
block.render(area, buf); block.render(area, buf);

View file

@ -1,12 +1,13 @@
//
use std::collections::BTreeMap; use std::collections::BTreeMap;
use git_next_core::ForgeAlias; use git_next_core::ForgeAlias;
use ratatui::{ use ratatui::{
buffer::Buffer, buffer::Buffer,
layout::{Direction, Layout, Rect, Size}, layout::{Direction, Layout, Rect},
widgets::StatefulWidget, widgets::{StatefulWidget, Widget},
}; };
use tui_scrollview::{ScrollView, ScrollViewState}; use tui_scrollview::ScrollViewState;
use crate::tui::actor::ForgeState; use crate::tui::actor::ForgeState;
@ -27,16 +28,10 @@ impl<'a> HeightContraintLength for ConfiguredAppWidget<'a> {
impl<'a> StatefulWidget for ConfiguredAppWidget<'a> { impl<'a> StatefulWidget for ConfiguredAppWidget<'a> {
type State = ScrollViewState; 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 where
Self: Sized, Self: Sized,
{ {
let height = self
.children()
.iter()
.map(HeightContraintLength::height_constraint_length)
.sum::<u16>();
let mut scroll = ScrollView::new(Size::new(area.width - 1, height));
let layout_forge_list = Layout::default() let layout_forge_list = Layout::default()
.direction(Direction::Vertical) .direction(Direction::Vertical)
.constraints( .constraints(
@ -44,14 +39,12 @@ impl<'a> StatefulWidget for ConfiguredAppWidget<'a> {
.iter() .iter()
.map(HeightContraintLength::height_constraint_length), .map(HeightContraintLength::height_constraint_length),
) )
.split(scroll.area()); .split(area);
self.children() self.children()
.into_iter() .into_iter()
.enumerate() .enumerate()
.for_each(|(i, w)| scroll.render_widget(w, layout_forge_list[i])); .for_each(|(i, w)| w.render(layout_forge_list[i], buf));
scroll.render(area, buf, state);
} }
} }
impl<'a> ConfiguredAppWidget<'a> { impl<'a> ConfiguredAppWidget<'a> {

View file

@ -5,7 +5,8 @@ use git_next_core::{ForgeAlias, RepoAlias};
use ratatui::{ use ratatui::{
buffer::Buffer, buffer::Buffer,
layout::{Alignment, Direction, Layout, Rect}, layout::{Alignment, Direction, Layout, Rect},
widgets::{block::Title, Block, Widget}, text::Line,
widgets::{Block, Widget},
}; };
use crate::tui::{ use crate::tui::{
@ -31,8 +32,8 @@ impl<'a> Widget for ExpandedForgeWidget<'a> {
where where
Self: Sized, Self: Sized,
{ {
let block = Block::default().title( let block = Block::default().title_top(
Title::from(format!(" forge: {} ", self.forge_alias)).alignment(Alignment::Left), Line::from(format!(" forge: {} ", self.forge_alias)).alignment(Alignment::Left),
); );
let children = self.children(); let children = self.children();
let layout = Layout::default() let layout = Layout::default()