From 34fb1966f09d785d3cbbe50eefe686086996d966 Mon Sep 17 00:00:00 2001 From: Conner Murphy Date: Fri, 8 Nov 2024 23:32:57 -0600 Subject: [PATCH] bump ratatui version --- Cargo.toml | 2 +- examples/color_changer/Cargo.toml | 2 +- examples/counter/Cargo.toml | 2 +- examples/hello_world/Cargo.toml | 2 +- src/backend.rs | 27 +++++++++++++++++++-------- src/lib.rs | 4 ++-- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0f7bead..410397d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,6 @@ repository = "https://github.com/TylerBloom/webatui" [dependencies] base16-palettes = "0.1.0" -ratatui = { version = "0.26", default-features = false } +ratatui = { version = "0.28", default-features = false } web-sys = { version = "0.3", features = ["Window", "Screen", "TouchEvent", "TouchList", "Touch", "CssStyleSheet", "StyleSheetList", "CssRuleList", "CssRule"] } yew = { version = "0.21", features = ["csr"] } diff --git a/examples/color_changer/Cargo.toml b/examples/color_changer/Cargo.toml index 1bd93e3..4c07c87 100644 --- a/examples/color_changer/Cargo.toml +++ b/examples/color_changer/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" [dependencies] webatui = { path = "../../" } -ratatui = { version = "0.26", default-features = false, features = ["all-widgets"] } +ratatui = { version = "0.28", default-features = false, features = ["all-widgets"] } base16-palettes = { version = "0.1", features = ["gruvbox"] } yew = "0.21" diff --git a/examples/counter/Cargo.toml b/examples/counter/Cargo.toml index a80d1a8..3f54956 100644 --- a/examples/counter/Cargo.toml +++ b/examples/counter/Cargo.toml @@ -5,6 +5,6 @@ edition = "2021" [dependencies] webatui = { path = "../../" } -ratatui = { version = "0.26", default-features = false, features = ["all-widgets"] } +ratatui = { version = "0.28", default-features = false, features = ["all-widgets"] } base16-palettes = "0.1" yew = "0.21" diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index d4a5008..4ac5593 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -5,4 +5,4 @@ edition = "2021" [dependencies] webatui = { path = "../../" } -ratatui = { version = "0.26", default-features = false, features = ["all-widgets"] } +ratatui = { version = "0.28", default-features = false, features = ["all-widgets"] } diff --git a/src/backend.rs b/src/backend.rs index 18cad32..81eab1f 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -5,7 +5,8 @@ use base16_palettes::{Base16Accent, Base16Color, Base16Palette, Base16Shade, Palette, Shade}; use ratatui::{ buffer::Cell, - prelude::{Backend, Rect}, + layout::Size, + prelude::Backend, style::{Color, Modifier, Style, Styled}, }; use std::{borrow::Cow, io::Result}; @@ -294,13 +295,11 @@ impl Backend for YewBackend { Ok(()) } - fn size(&self) -> Result { - Ok(Rect::new( - 0, - 0, - self.buffer.first().unwrap().len().saturating_sub(1) as u16, - self.buffer.len().saturating_sub(1) as u16, - )) + fn size(&self) -> Result { + Ok(Size { + width: self.buffer.first().unwrap().len().saturating_sub(1) as u16, + height: self.buffer.len().saturating_sub(1) as u16, + }) } fn window_size(&mut self) -> Result { @@ -311,6 +310,18 @@ impl Backend for YewBackend { self.prerender(); Ok(()) } + + fn get_cursor_position(&mut self) -> Result { + todo!() + } + + fn set_cursor_position>( + &mut self, + position: P, + ) -> Result<()> { + let _ = position; + todo!() + } } fn create_span(p: &Palette, fg: Color, bg: Color, mods: Modifier, text: &str) -> Html { diff --git a/src/lib.rs b/src/lib.rs index d82c583..d97dd78 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -281,8 +281,8 @@ impl Component for WebTerminal { fn view(&self, ctx: &Context) -> yew::Html { let mut term = self.term.borrow_mut(); - let area = term.size().unwrap(); - term.draw(|frame| self.app.render(area, frame)).unwrap(); + term.draw(|frame| self.app.render(frame.area(), frame)) + .unwrap(); term.backend_mut() .hydrate(|span| self.app.hydrate(ctx, span)) }