Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

chore: update ratatui to 0.26 #32

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["cli", "console", "ratatui", "terminal", "tui"]
derive_builder = "0.13.0"
font8x8 = "0.3.1"
itertools = "0.12.0"
ratatui = "0.25.0"
ratatui = ">=0.25.0"

[dev-dependencies]
anyhow = "1.0.44"
Expand All @@ -22,3 +22,4 @@ crossterm = { version = "0.27.0", features = ["event-stream"] }
futures = "0.3"
strum = { version = "0.26.1", features = ["derive"] }
tokio = { version = "1.16", features = ["full"] }
ratatui = "0.26.0"
9 changes: 4 additions & 5 deletions examples/pixel_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ fn main() -> Result<()> {
fn render(frame: &mut Frame) -> Result<()> {
// Setup layout for 4 blocks
use Constraint::*;
let layout =
Layout::new(Direction::Vertical, [Length(8), Length(4), Length(8)]).split(frame.size());
let [top, middle, bottom] = [layout[0], layout[1], layout[2]];
let bottom_layout = Layout::new(Direction::Horizontal, [Length(32), Length(32)]).split(bottom);
let [bottom_left, bottom_right] = [bottom_layout[0], bottom_layout[1]];
let [top, middle, bottom] =
Layout::new(Direction::Vertical, [Length(8), Length(4), Length(8)]).areas(frame.size());
let [bottom_left, bottom_right] =
Layout::new(Direction::Horizontal, [Length(32), Length(32)]).areas(bottom);

// render one block for each font size
// Draw block showing Full size
Expand Down
34 changes: 14 additions & 20 deletions examples/stopwatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ impl StopwatchApp {

fn fps_paragraph(&mut self) -> Paragraph<'_> {
let fps = format!("{:.2} fps", self.fps_counter.fps);
Paragraph::new(fps)
.style(Style::new().dim())
.alignment(Alignment::Right)
Paragraph::new(fps).dim().right_aligned()
}

fn timer_paragraph(&mut self) -> BigText<'_> {
Expand Down Expand Up @@ -187,23 +185,19 @@ impl StopwatchApp {
}

fn layout(area: Rect) -> Vec<Rect> {
let layout = Layout::default()
.direction(Direction::Vertical)
.constraints(vec![
Constraint::Length(2), // top bar
Constraint::Length(8), // timer
Constraint::Length(1), // splits header
Constraint::Min(0), // splits
Constraint::Length(1), // help
])
.split(area);
let top_layout = Layout::default()
.direction(Direction::Horizontal)
.constraints(vec![
Constraint::Length(20), // title
Constraint::Min(0), // fps counter
])
.split(layout[0]);
let layout = Layout::vertical(vec![
Constraint::Length(2), // top bar
Constraint::Length(8), // timer
Constraint::Length(1), // splits header
Constraint::Min(0), // splits
Constraint::Length(1), // help
])
.split(area);
let top_layout = Layout::horizontal(vec![
Constraint::Length(20), // title
Constraint::Min(0), // fps counter
])
.split(layout[0]);

// return a new vec with the top_layout rects and then rest of layout
top_layout[..]
Expand Down
Loading