mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-10-18 19:10:36 +08:00
Update to ratatui 0.29.0
This commit is contained in:
Generated
+101
-31
@@ -140,9 +140,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ansi-to-tui"
|
||||
version = "5.0.0-rc.1"
|
||||
version = "7.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "428c2992b874104caf39204b05bf89eab4ceefdd4fcb26caa6759906f547f8e8"
|
||||
checksum = "67555e1f1ece39d737e28c8a017721287753af3f93225e4a445b29ccb0f5912c"
|
||||
dependencies = [
|
||||
"nom",
|
||||
"ratatui",
|
||||
@@ -432,13 +432,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compact_str"
|
||||
version = "0.7.1"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f"
|
||||
checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644"
|
||||
dependencies = [
|
||||
"castaway",
|
||||
"cfg-if",
|
||||
"itoa",
|
||||
"rustversion",
|
||||
"ryu",
|
||||
"static_assertions",
|
||||
]
|
||||
@@ -593,6 +594,41 @@ dependencies = [
|
||||
"socks5-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.90",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.5.0"
|
||||
@@ -786,6 +822,12 @@ dependencies = [
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.1"
|
||||
@@ -979,6 +1021,12 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.5.0"
|
||||
@@ -999,6 +1047,12 @@ dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indoc"
|
||||
version = "2.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
||||
|
||||
[[package]]
|
||||
name = "inout"
|
||||
version = "0.1.3"
|
||||
@@ -1023,7 +1077,21 @@ dependencies = [
|
||||
"tempfile",
|
||||
"termion 2.0.3",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"unicode-width 0.1.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instability"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b829f37dead9dc39df40c2d3376c179fdfd2ac771f53f55d3c30dc096a3c0c6e"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"indoc",
|
||||
"pretty_assertions",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1935,24 +2003,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.27.0"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d16546c5b5962abf8ce6e2881e722b4e0ae3b6f1a08a26ae3573c55853ca68d3"
|
||||
checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"cassowary",
|
||||
"compact_str",
|
||||
"indoc",
|
||||
"instability",
|
||||
"itertools",
|
||||
"lru",
|
||||
"paste",
|
||||
"stability",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"termion 4.0.2",
|
||||
"time 0.3.34",
|
||||
"unicode-segmentation",
|
||||
"unicode-truncate",
|
||||
"unicode-width",
|
||||
"unicode-width 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2394,16 +2462,6 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stability"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
@@ -2417,10 +2475,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.1"
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
@@ -2546,7 +2610,7 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
|
||||
dependencies = [
|
||||
"smawk",
|
||||
"unicode-linebreak",
|
||||
"unicode-width",
|
||||
"unicode-width 0.1.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2842,23 +2906,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tui-textarea"
|
||||
version = "0.5.1"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a13589ef83273780b53a0e0be49282cb5d9cc10727b6c580e8f11366ccb460c"
|
||||
checksum = "0a5318dd619ed73c52a9417ad19046724effc1287fb75cdcc4eca1d6ac1acbae"
|
||||
dependencies = [
|
||||
"ratatui",
|
||||
"termion 4.0.2",
|
||||
"unicode-width",
|
||||
"unicode-width 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tui-tree-widget"
|
||||
version = "0.21.0"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ac69db35529be6a75f9d27516ff33df299e2e8e961a1986d52185cef0427352"
|
||||
checksum = "fcc95ebc9c578c67223514d0e10a75c3b996d1f22dc93a4792475260f7c3c11e"
|
||||
dependencies = [
|
||||
"ratatui",
|
||||
"unicode-width",
|
||||
"unicode-width 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2917,7 +2981,7 @@ checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"unicode-width 0.1.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2926,6 +2990,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 = "universal-hash"
|
||||
version = "0.5.1"
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@ path = "bin/main.rs"
|
||||
required-features = ["bin"]
|
||||
|
||||
[dependencies]
|
||||
ansi-to-tui = { version = "5.0.0-rc.1" }
|
||||
ansi-to-tui = { version = "7.0.0" }
|
||||
anyhow = { version = "1" }
|
||||
inquire = { version = "0.7.4", default-features = false, features = ["termion", "editor"] }
|
||||
lexopt = { version = "0.3.0" }
|
||||
@@ -37,7 +37,7 @@ radicle-term = { version = "0.12.0" }
|
||||
radicle-cli = { version = "0.12.1" }
|
||||
radicle-surf = { version = "0.22.0" }
|
||||
radicle-signals = { version = "0.10.0" }
|
||||
ratatui = { version = "0.27.0", default-features = false, features = ["all-widgets", "termion"] }
|
||||
ratatui = { version = "0.29.0", default-features = false, features = ["all-widgets", "termion"] }
|
||||
simple-logging = { version = "2.0.2" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = { version = "1.0" }
|
||||
@@ -49,8 +49,8 @@ textwrap = { version = "0.16.0" }
|
||||
thiserror = { version = "1" }
|
||||
tokio = { version = "1.32.0", features = ["full"] }
|
||||
tokio-stream = { version = "0.1.14" }
|
||||
tui-textarea = { version = "0.5.1", default-features = false, features = ["termion"] }
|
||||
tui-tree-widget = { version = "0.21.0" }
|
||||
tui-textarea = { version = "0.7.0", default-features = false, features = ["termion"] }
|
||||
tui-tree-widget = { version = "0.23.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "^1.4.1"
|
||||
|
||||
+21
-25
@@ -15,9 +15,8 @@ use super::event::Event;
|
||||
|
||||
pub type Backend<S> = TermionBackendExt<S>;
|
||||
|
||||
pub type InlineTerminal = ratatui::terminal::Terminal<Backend<RawTerminal<io::Stdout>>>;
|
||||
pub type FullscreenTerminal =
|
||||
ratatui::terminal::Terminal<Backend<AlternateScreen<RawTerminal<io::Stdout>>>>;
|
||||
pub type InlineTerminal = ratatui::Terminal<Backend<RawTerminal<io::Stdout>>>;
|
||||
pub type FullscreenTerminal = ratatui::Terminal<Backend<AlternateScreen<RawTerminal<io::Stdout>>>>;
|
||||
|
||||
pub enum Terminal {
|
||||
Inline(InlineTerminal),
|
||||
@@ -32,8 +31,9 @@ impl Terminal {
|
||||
}
|
||||
Terminal::Inline(inner) => {
|
||||
// TODO(erikli): Check if still needed.
|
||||
let size = inner.get_frame().size();
|
||||
inner.set_cursor(size.x, size.y)?;
|
||||
let area = inner.get_frame().area();
|
||||
let position = Position::new(area.x, area.y);
|
||||
inner.set_cursor_position(position)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,10 +59,8 @@ impl TryFrom<Viewport> for Terminal {
|
||||
Viewport::Fullscreen => {
|
||||
let stdout = io::stdout().into_raw_mode()?.into_alternate_screen()?;
|
||||
let options = TerminalOptions { viewport };
|
||||
let mut terminal = ratatui::terminal::Terminal::with_options(
|
||||
TermionBackendExt::new(stdout),
|
||||
options,
|
||||
)?;
|
||||
let mut terminal =
|
||||
ratatui::Terminal::with_options(TermionBackendExt::new(stdout), options)?;
|
||||
|
||||
terminal.clear()?;
|
||||
|
||||
@@ -71,10 +69,8 @@ impl TryFrom<Viewport> for Terminal {
|
||||
_ => {
|
||||
let stdout = io::stdout().into_raw_mode()?;
|
||||
let options = TerminalOptions { viewport };
|
||||
let terminal = ratatui::terminal::Terminal::with_options(
|
||||
TermionBackendExt::new(stdout),
|
||||
options,
|
||||
)?;
|
||||
let terminal =
|
||||
ratatui::Terminal::with_options(TermionBackendExt::new(stdout), options)?;
|
||||
|
||||
Ok(Terminal::Inline(terminal))
|
||||
}
|
||||
@@ -88,7 +84,7 @@ pub struct TermionBackendExt<W>
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
cursor: Option<(u16, u16)>,
|
||||
cursor: Option<Position>,
|
||||
inner: TermionBackend<W>,
|
||||
}
|
||||
|
||||
@@ -124,20 +120,20 @@ impl<W: Write> ratatui::backend::Backend for TermionBackendExt<W> {
|
||||
self.inner.show_cursor()
|
||||
}
|
||||
|
||||
fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
|
||||
match self.inner.get_cursor() {
|
||||
Ok((x, y)) => {
|
||||
let cursor = (x.saturating_sub(0), y.saturating_sub(0));
|
||||
self.cursor = Some(cursor);
|
||||
Ok(cursor)
|
||||
fn get_cursor_position(&mut self) -> io::Result<Position> {
|
||||
match self.inner.get_cursor_position() {
|
||||
Ok(position) => {
|
||||
self.cursor = Some(position);
|
||||
Ok(position)
|
||||
}
|
||||
Err(_) => Ok(self.cursor.unwrap_or((0, 0))),
|
||||
Err(_) => Ok(self.cursor.unwrap_or_default()),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
|
||||
self.cursor = Some((x, y));
|
||||
self.inner.set_cursor(x, y)
|
||||
fn set_cursor_position<P: Into<Position>>(&mut self, position: P) -> io::Result<()> {
|
||||
self.cursor = Some(position.into());
|
||||
self.inner
|
||||
.set_cursor_position(self.cursor.unwrap_or_default())
|
||||
}
|
||||
|
||||
fn clear(&mut self) -> io::Result<()> {
|
||||
@@ -148,7 +144,7 @@ impl<W: Write> ratatui::backend::Backend for TermionBackendExt<W> {
|
||||
self.inner.clear_region(clear_type)
|
||||
}
|
||||
|
||||
fn size(&self) -> io::Result<Rect> {
|
||||
fn size(&self) -> io::Result<Size> {
|
||||
self.inner.size()
|
||||
}
|
||||
|
||||
|
||||
+63
-49
@@ -1,5 +1,5 @@
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::layout::{Position, Rect};
|
||||
use ratatui::style::Style;
|
||||
use ratatui::symbols;
|
||||
use ratatui::widgets::{BorderType, Borders, Widget};
|
||||
@@ -60,55 +60,63 @@ impl Widget for HeaderBlock {
|
||||
// Sides
|
||||
if self.borders.intersects(Borders::LEFT) {
|
||||
for y in area.top()..area.bottom() {
|
||||
buf.get_mut(area.left(), y)
|
||||
.set_symbol(symbols.vertical_left)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.left(), y)) {
|
||||
cell.set_symbol(symbols.vertical_left)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
if self.borders.intersects(Borders::TOP) {
|
||||
for x in area.left()..area.right() {
|
||||
buf.get_mut(x, area.top())
|
||||
.set_symbol(symbols.horizontal_top)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(x, area.top())) {
|
||||
cell.set_symbol(symbols.horizontal_top)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
if self.borders.intersects(Borders::RIGHT) {
|
||||
let x = area.right() - 1;
|
||||
for y in area.top()..area.bottom() {
|
||||
buf.get_mut(x, y)
|
||||
.set_symbol(symbols.vertical_right)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(x, y)) {
|
||||
cell.set_symbol(symbols.vertical_right)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
if self.borders.intersects(Borders::BOTTOM) {
|
||||
let y = area.bottom() - 1;
|
||||
for x in area.left()..area.right() {
|
||||
buf.get_mut(x, y)
|
||||
.set_symbol(symbols.horizontal_bottom)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(x, y)) {
|
||||
cell.set_symbol(symbols.horizontal_bottom)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Corners
|
||||
if self.borders.contains(Borders::RIGHT | Borders::BOTTOM) {
|
||||
buf.get_mut(area.right() - 1, area.bottom() - 1)
|
||||
.set_symbol(symbols::line::VERTICAL_LEFT)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.right() - 1, area.bottom() - 1)) {
|
||||
cell.set_symbol(symbols::line::VERTICAL_LEFT)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
if self.borders.contains(Borders::RIGHT | Borders::TOP) {
|
||||
buf.get_mut(area.right() - 1, area.top())
|
||||
.set_symbol(symbols.top_right)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.right() - 1, area.top())) {
|
||||
cell.set_symbol(symbols.top_right)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
if self.borders.contains(Borders::LEFT | Borders::BOTTOM) {
|
||||
buf.get_mut(area.left(), area.bottom() - 1)
|
||||
.set_symbol(symbols::line::VERTICAL_RIGHT)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.left(), area.bottom() - 1)) {
|
||||
cell.set_symbol(symbols::line::VERTICAL_RIGHT)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
if self.borders.contains(Borders::LEFT | Borders::TOP) {
|
||||
buf.get_mut(area.left(), area.top())
|
||||
.set_symbol(symbols.top_left)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.left(), area.top())) {
|
||||
cell.set_symbol(symbols.top_left)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,32 +205,36 @@ impl Widget for FooterBlock {
|
||||
// Sides
|
||||
if self.borders.intersects(Borders::LEFT) {
|
||||
for y in area.top()..area.bottom() {
|
||||
buf.get_mut(area.left(), y)
|
||||
.set_symbol(symbols.vertical_left)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.left(), y)) {
|
||||
cell.set_symbol(symbols.vertical_left)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
if self.borders.intersects(Borders::TOP) {
|
||||
for x in area.left()..area.right() {
|
||||
buf.get_mut(x, area.top())
|
||||
.set_symbol(symbols.horizontal_top)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(x, area.top())) {
|
||||
cell.set_symbol(symbols.horizontal_top)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
if self.borders.intersects(Borders::RIGHT) {
|
||||
let x = area.right() - 1;
|
||||
for y in area.top()..area.bottom() {
|
||||
buf.get_mut(x, y)
|
||||
.set_symbol(symbols.vertical_right)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(x, y)) {
|
||||
cell.set_symbol(symbols.vertical_right)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
if self.borders.intersects(Borders::BOTTOM) {
|
||||
let y = area.bottom() - 1;
|
||||
for x in area.left()..area.right() {
|
||||
buf.get_mut(x, y)
|
||||
.set_symbol(symbols.horizontal_bottom)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(x, y)) {
|
||||
cell.set_symbol(symbols.horizontal_bottom)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,28 +244,30 @@ impl Widget for FooterBlock {
|
||||
FooterBlockType::Begin | FooterBlockType::Repeat => symbols::line::HORIZONTAL_UP,
|
||||
_ => symbols.bottom_right,
|
||||
};
|
||||
buf.get_mut(area.right() - 1, area.bottom() - 1)
|
||||
.set_symbol(symbol)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.right() - 1, area.bottom() - 1)) {
|
||||
cell.set_symbol(symbol).set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
if self.borders.contains(Borders::RIGHT | Borders::TOP) {
|
||||
let symbol = match self.block_type {
|
||||
FooterBlockType::Begin | FooterBlockType::Repeat => symbols::line::HORIZONTAL_DOWN,
|
||||
_ => symbols::line::VERTICAL_LEFT,
|
||||
};
|
||||
buf.get_mut(area.right() - 1, area.top())
|
||||
.set_symbol(symbol)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.right() - 1, area.top())) {
|
||||
cell.set_symbol(symbol).set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
if self.borders.contains(Borders::LEFT | Borders::BOTTOM) {
|
||||
buf.get_mut(area.left(), area.bottom() - 1)
|
||||
.set_symbol(symbols.bottom_left)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.left(), area.bottom() - 1)) {
|
||||
cell.set_symbol(symbols.bottom_left)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
if self.borders.contains(Borders::LEFT | Borders::TOP) {
|
||||
buf.get_mut(area.left(), area.top())
|
||||
.set_symbol(symbols::line::VERTICAL_RIGHT)
|
||||
.set_style(self.border_style);
|
||||
if let Some(cell) = buf.cell_mut(Position::new(area.left(), area.top())) {
|
||||
cell.set_symbol(symbols::line::VERTICAL_RIGHT)
|
||||
.set_style(self.border_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ impl Frontend {
|
||||
}
|
||||
}
|
||||
terminal.draw(|frame| {
|
||||
let ctx = ctx.clone().with_frame_size(frame.size());
|
||||
let ctx = ctx.clone().with_frame_size(frame.area());
|
||||
|
||||
if let Err(err) = state.show(&ctx, frame) {
|
||||
log::warn!("Drawing failed: {}", err);
|
||||
|
||||
+5
-3
@@ -453,7 +453,7 @@ where
|
||||
.rows(rows)
|
||||
.widths(widths)
|
||||
.column_spacing(1)
|
||||
.highlight_style(style::highlight(area_focus));
|
||||
.row_highlight_style(style::highlight(area_focus));
|
||||
|
||||
let table = if !area_focus && self.dim {
|
||||
table.dim()
|
||||
@@ -1051,7 +1051,8 @@ impl<'a> TextEdit<'a> {
|
||||
frame.render_widget(overline, layout[1]);
|
||||
|
||||
if self.show_cursor {
|
||||
frame.set_cursor(top_layout[2].x + cursor_pos, top_layout[2].y)
|
||||
let position = Position::new(top_layout[2].x + cursor_pos, top_layout[2].y);
|
||||
frame.set_cursor_position(position)
|
||||
}
|
||||
} else {
|
||||
let top = Line::from([input].to_vec());
|
||||
@@ -1061,7 +1062,8 @@ impl<'a> TextEdit<'a> {
|
||||
frame.render_widget(bottom, layout[1]);
|
||||
|
||||
if self.show_cursor {
|
||||
frame.set_cursor(area.x + cursor_pos, area.y)
|
||||
let position = Position::new(area.x + cursor_pos, area.y);
|
||||
frame.set_cursor_position(position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ impl Frontend {
|
||||
break Ok(interrupted);
|
||||
}
|
||||
}
|
||||
terminal.draw(|frame| root.render(RenderProps::from(frame.size()), frame))?;
|
||||
terminal.draw(|frame| root.render(RenderProps::from(frame.area()), frame))?;
|
||||
};
|
||||
terminal.restore()?;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::Frame;
|
||||
use termion::event::Key;
|
||||
|
||||
use ratatui::layout::{Alignment, Constraint, Layout, Rect};
|
||||
use ratatui::layout::{Alignment, Constraint, Layout, Position, Rect};
|
||||
use ratatui::style::{Style, Stylize};
|
||||
use ratatui::text::{Line, Span, Text};
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::ui::theme::Theme;
|
||||
|
||||
@@ -287,7 +287,10 @@ where
|
||||
frame.render_widget(overline, layout[1]);
|
||||
|
||||
if props.show_cursor {
|
||||
frame.set_cursor(top_layout[2].x + cursor_pos, top_layout[2].y)
|
||||
frame.set_cursor_position(Position::new(
|
||||
top_layout[2].x + cursor_pos,
|
||||
top_layout[2].y,
|
||||
))
|
||||
}
|
||||
} else {
|
||||
let top = Line::from([input].to_vec());
|
||||
@@ -297,7 +300,7 @@ where
|
||||
frame.render_widget(bottom, layout[1]);
|
||||
|
||||
if props.show_cursor {
|
||||
frame.set_cursor(area.x + cursor_pos, area.y)
|
||||
frame.set_cursor_position(Position::new(area.x + cursor_pos, area.y))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -516,7 +519,7 @@ impl<'a, S, M> View for TextArea<'a, S, M> {
|
||||
(self.textarea.cursor().0, self.textarea.cursor().1),
|
||||
);
|
||||
|
||||
frame.render_widget(self.textarea.widget(), content_area);
|
||||
frame.render_widget(&self.textarea, content_area);
|
||||
|
||||
let mut progress_info = vec![];
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ where
|
||||
.rows(rows)
|
||||
.widths(widths)
|
||||
.column_spacing(1)
|
||||
.highlight_style(style::highlight(render.focus));
|
||||
.row_highlight_style(style::highlight(render.focus));
|
||||
|
||||
let table = if !render.focus && props.dim {
|
||||
table.dim()
|
||||
|
||||
@@ -104,7 +104,7 @@ where
|
||||
.and_then(|props| props.inner_ref::<WindowProps<Id>>())
|
||||
.unwrap_or(&default);
|
||||
|
||||
let area = frame.size();
|
||||
let area = frame.area();
|
||||
|
||||
let page = props
|
||||
.current_page
|
||||
|
||||
Reference in New Issue
Block a user