diff --git a/Cargo.lock b/Cargo.lock index 57077fb..3367079 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,6 +62,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "block" version = "0.1.6" @@ -197,9 +203,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "enum-iterator" @@ -231,6 +237,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "indoc" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "kmon" version = "1.6.3" @@ -261,9 +288,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.141" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libloading" @@ -329,7 +356,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset", @@ -386,6 +413,12 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "pkg-config" version = "0.3.26" @@ -394,30 +427,34 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "ratatui" -version = "0.20.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829" +checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad" dependencies = [ - "bitflags", + "bitflags 2.4.1", "cassowary", + "indoc", + "itertools", + "paste", + "strum", "termion", "unicode-segmentation", "unicode-width", @@ -429,7 +466,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -447,6 +484,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "scoped-tls" version = "1.0.1" @@ -465,7 +508,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" dependencies = [ - "bitflags", + "bitflags 1.3.2", "dlib", "lazy_static", "log", @@ -493,11 +536,33 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "syn" -version = "2.0.15" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -518,9 +583,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-segmentation" @@ -546,7 +611,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ - "bitflags", + "bitflags 1.3.2", "downcast-rs", "libc", "nix", @@ -585,7 +650,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-client", "wayland-commons", "wayland-scanner", diff --git a/Cargo.toml b/Cargo.toml index 66efb65..7b0b48d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ include = ["src/**/*", "Cargo.*", "LICENSE", "README.md", "CHANGELOG.md"] edition = "2021" [dependencies] -tui = { package = "ratatui", version = "0.20.1", default-features = false, features = ["termion"] } +tui = { package = "ratatui", version = "0.23.0", default-features = false, features = ["termion"] } termion = "2.0.1" bytesize = "1.3.0" unicode-width = "0.1.11" diff --git a/src/app.rs b/src/app.rs index 55a832b..ffe3f4d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -16,7 +16,7 @@ use termion::event::Key; use tui::backend::Backend; use tui::layout::{Alignment, Constraint, Direction, Layout, Rect}; use tui::style::Style as TuiStyle; -use tui::text::{Span, Spans, Text}; +use tui::text::{Line, Span, Text}; use tui::widgets::{ Block as TuiBlock, Borders, Clear, List, ListItem, Paragraph, Row, Table, Wrap, }; @@ -256,12 +256,12 @@ impl App { let mut help_text = Vec::new(); let mut help_text_raw = Vec::new(); for (key, desc) in &key_bindings { - help_text.push(Spans::from(Span::styled( + help_text.push(Line::from(Span::styled( format!("{}:", &key), self.style.colored, ))); help_text_raw.push(format!("{key}:")); - help_text.push(Spans::from(Span::styled( + help_text.push(Line::from(Span::styled( format!("{}{}", self.style.unicode.get(Symbol::Blank), &desc), self.style.default, ))); @@ -306,7 +306,7 @@ impl App { ); let mut dependent_modules = Vec::new(); for module in &dependent_modules_list { - dependent_modules.push(Spans::from(vec![ + dependent_modules.push(Line::from(vec![ Span::styled("-", self.style.colored), Span::styled(format!(" {module}"), self.style.default), ])); diff --git a/src/kernel/lkm.rs b/src/kernel/lkm.rs index dfbce4e..3d95619 100644 --- a/src/kernel/lkm.rs +++ b/src/kernel/lkm.rs @@ -5,7 +5,7 @@ use crate::util; use bytesize::ByteSize; use clap::ArgMatches; use std::slice::Iter; -use tui::text::{Span, Spans, Text}; +use tui::text::{Line, Span, Text}; /* Type of the sorting of module list */ #[derive(Clone, Copy, Debug)] @@ -168,15 +168,15 @@ impl KernelModules<'_> { self.current_info.set( Text::from({ let mut spans = vec![ - Spans::from(Span::styled( + Line::from(Span::styled( "Execute the following command? [y/N]:", self.style.colored, )), - Spans::from(Span::styled( + Line::from(Span::styled( self.get_current_command().cmd, self.style.default, )), - Spans::default(), + Line::default(), ]; spans.append( &mut Text::styled( @@ -207,15 +207,15 @@ impl KernelModules<'_> { self.current_info.set( Text::from({ let mut spans = vec![ - Spans::from(Span::styled( + Line::from(Span::styled( "Failed to execute command:", self.style.colored, )), - Spans::from(Span::styled( + Line::from(Span::styled( format!("'{}'", self.get_current_command().cmd), self.style.default, )), - Spans::default(), + Line::default(), ]; spans.append( &mut Text::styled(e.to_string(), self.style.default) diff --git a/src/style.rs b/src/style.rs index 788f921..2ad40d8 100644 --- a/src/style.rs +++ b/src/style.rs @@ -2,7 +2,7 @@ use clap::ArgMatches; use colorsys::Rgb; use std::collections::HashMap; use tui::style::{Color, Modifier, Style as TuiStyle}; -use tui::text::{Span, Spans, Text}; +use tui::text::{Line, Span, Text}; /* Unicode symbol */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] @@ -202,14 +202,14 @@ impl<'a> StyledText<'a> { for line in text.lines() { let data = line.split(delimiter).collect::>(); if data.len() > 1 && data[0].trim().len() > 2 { - self.styled_text.lines.push(Spans::from(vec![ + self.styled_text.lines.push(Line::from(vec![ Span::styled(format!("{}{}", data[0], delimiter), style.colored), Span::styled(data[1..data.len()].join(delimiter), style.default), ])); } else { self.styled_text .lines - .push(Spans::from(Span::styled(line, style.default))) + .push(Line::from(Span::styled(line, style.default))) } } self.styled_text.clone()