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
4 changed files with 50 additions and 38 deletions

36
Cargo.lock generated
View file

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

View file

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

View file

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

View file

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