mirror of
https://github.com/coastalwhite/lemurs
synced 2024-11-29 13:10:16 +00:00
Update Dependencies: Ratatui and Crossterm
This commit is contained in:
parent
0743de7365
commit
07e8267635
10 changed files with 124 additions and 140 deletions
199
Cargo.lock
generated
199
Cargo.lock
generated
|
@ -34,12 +34,12 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.20.0"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0ebde6a9dd5e331cd6c6f48253254d117642c31653baa475e394657c59c1f7d"
|
||||
checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crossterm_winapi 0.8.0",
|
||||
"crossterm_winapi",
|
||||
"libc 0.2.139",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
|
@ -48,31 +48,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c85525306c4291d1b73ce93c8acf9c339f9b213aef6c1d85c3830cbf1c16325c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crossterm_winapi 0.9.0",
|
||||
"libc 0.2.139",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"signal-hook",
|
||||
"signal-hook-mio",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm_winapi"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a6966607622438301997d3dac0d2f6e9a90c68bb6bc1785ea98456ab93c0507"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm_winapi"
|
||||
version = "0.9.0"
|
||||
|
@ -109,20 +84,11 @@ version = "2.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemurs"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"crossterm 0.22.1",
|
||||
"crossterm",
|
||||
"env_logger",
|
||||
"libc 0.2.139",
|
||||
"log",
|
||||
|
@ -131,9 +97,9 @@ dependencies = [
|
|||
"pam",
|
||||
"pgs-files",
|
||||
"rand",
|
||||
"ratatui",
|
||||
"serde",
|
||||
"toml",
|
||||
"tui",
|
||||
"unicode-width",
|
||||
"users 0.11.0",
|
||||
]
|
||||
|
@ -180,24 +146,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.7.14"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
|
||||
checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
|
||||
dependencies = [
|
||||
"libc 0.2.139",
|
||||
"log",
|
||||
"miow",
|
||||
"ntapi",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"wasi",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -213,21 +169,6 @@ dependencies = [
|
|||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "numtoa"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.17.1"
|
||||
|
@ -256,27 +197,25 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.2"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
||||
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
||||
dependencies = [
|
||||
"instant",
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.8.6"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
|
||||
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"instant",
|
||||
"libc 0.2.139",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"winapi",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -343,21 +282,25 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.16"
|
||||
name = "ratatui"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
checksum = "ce841e0486e7c2412c3740168ede33adeba8e154a15107b879d8162d77c7174e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"crossterm",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_termios"
|
||||
version = "0.1.2"
|
||||
name = "redox_syscall"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f"
|
||||
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||
dependencies = [
|
||||
"redox_syscall",
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -433,18 +376,6 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termion"
|
||||
version = "1.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e"
|
||||
dependencies = [
|
||||
"libc 0.2.139",
|
||||
"numtoa",
|
||||
"redox_syscall",
|
||||
"redox_termios",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.11"
|
||||
|
@ -454,20 +385,6 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tui"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39c8ce4e27049eed97cfa363a5048b09d995e209994634a0efc26a14ab6c0c23"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"crossterm 0.20.0",
|
||||
"termion",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.6"
|
||||
|
@ -532,3 +449,69 @@ name = "winapi-x86_64-pc-windows-gnu"
|
|||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
||||
|
|
|
@ -17,9 +17,9 @@ license = "MIT or APACHE"
|
|||
|
||||
[dependencies]
|
||||
# UI and TUI interface
|
||||
tui = { version = "0.16.0", features = [ "crossterm" ] }
|
||||
ratatui = "0.21.0"
|
||||
crossterm = "0.26"
|
||||
unicode-width = "0.1"
|
||||
crossterm = { version = "0.22" }
|
||||
|
||||
# Interacting with the kernel interfaces
|
||||
rand = "0.8.4"
|
||||
|
|
|
@ -7,7 +7,7 @@ use crossterm::event::KeyCode;
|
|||
use log::error;
|
||||
use serde::{de::Error, Deserialize};
|
||||
|
||||
use tui::style::{Color, Modifier};
|
||||
use ratatui::style::{Color, Modifier};
|
||||
|
||||
pub fn get_color(color: &str) -> Color {
|
||||
if let Some(color) = str_to_color(color) {
|
||||
|
|
|
@ -9,8 +9,8 @@ use crossterm::{
|
|||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
};
|
||||
use log::{error, info, warn};
|
||||
use tui::backend::CrosstermBackend;
|
||||
use tui::Terminal;
|
||||
use ratatui::backend::CrosstermBackend;
|
||||
use ratatui::Terminal;
|
||||
|
||||
mod auth;
|
||||
mod chvt;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
Frame,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crossterm::event::{KeyCode, KeyModifiers};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
layout::Rect,
|
||||
style::Style,
|
||||
terminal::Frame,
|
||||
|
@ -290,7 +290,7 @@ impl InputFieldWidget {
|
|||
|
||||
pub fn render(
|
||||
&mut self,
|
||||
frame: &mut Frame<impl tui::backend::Backend>,
|
||||
frame: &mut Frame<impl ratatui::backend::Backend>,
|
||||
area: Rect,
|
||||
is_focused: bool,
|
||||
) {
|
||||
|
@ -302,17 +302,18 @@ impl InputFieldWidget {
|
|||
self.width = inner.width;
|
||||
|
||||
let show_string = self.show_string();
|
||||
let widget = Paragraph::new(show_string.as_ref())
|
||||
.style(self.get_text_style(is_focused))
|
||||
.block(self.get_block(is_focused));
|
||||
|
||||
frame.render_widget(widget, area);
|
||||
|
||||
if is_focused {
|
||||
let Rect { x, y, .. } = inner;
|
||||
let cursor_offset = get_byte_offset_of_char_offset(&show_string, self.cursor.into());
|
||||
frame.set_cursor(x + show_string[..cursor_offset].width() as u16, y);
|
||||
}
|
||||
|
||||
let widget = Paragraph::new(show_string)
|
||||
.style(self.get_text_style(is_focused))
|
||||
.block(self.get_block(is_focused));
|
||||
|
||||
frame.render_widget(widget, area);
|
||||
}
|
||||
|
||||
pub(crate) fn key_press(
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::process::{Command, Output};
|
||||
|
||||
use crossterm::event::KeyCode;
|
||||
use tui::layout::{Alignment, Rect};
|
||||
use tui::style::Style;
|
||||
use tui::text::{Span, Spans, Text};
|
||||
use tui::widgets::Paragraph;
|
||||
use tui::Frame;
|
||||
use ratatui::layout::{Alignment, Rect};
|
||||
use ratatui::style::Style;
|
||||
use ratatui::text::{Span, Line, Text};
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::config::{
|
||||
get_color, get_key, get_modifiers, PowerControlConfig, SwitcherConfig, SwitcherVisibility,
|
||||
|
@ -54,7 +54,7 @@ impl KeyMenuWidget {
|
|||
style
|
||||
}
|
||||
|
||||
pub fn render(&self, frame: &mut Frame<impl tui::backend::Backend>, area: Rect) {
|
||||
pub fn render(&self, frame: &mut Frame<impl ratatui::backend::Backend>, area: Rect) {
|
||||
let mut items = Vec::new();
|
||||
|
||||
if self.power_config.allow_shutdown {
|
||||
|
@ -93,7 +93,7 @@ impl KeyMenuWidget {
|
|||
}
|
||||
|
||||
let mut text = Text::raw("");
|
||||
text.lines.push(Spans(items));
|
||||
text.lines.push(Line::from(items));
|
||||
let left_widget = Paragraph::new(text);
|
||||
|
||||
frame.render_widget(left_widget, area);
|
||||
|
|
|
@ -17,8 +17,8 @@ use crossterm::execute;
|
|||
use crossterm::terminal::{
|
||||
disable_raw_mode, enable_raw_mode, Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen,
|
||||
};
|
||||
use tui::backend::CrosstermBackend;
|
||||
use tui::{backend::Backend, Frame, Terminal};
|
||||
use ratatui::backend::CrosstermBackend;
|
||||
use ratatui::{backend::Backend, Frame, Terminal};
|
||||
|
||||
mod chunks;
|
||||
mod input_field;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use tui::backend::Backend;
|
||||
use tui::layout::Rect;
|
||||
use tui::style::Color;
|
||||
use tui::widgets::Paragraph;
|
||||
use tui::Frame;
|
||||
use ratatui::backend::Backend;
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::style::{Style, Color};
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::auth::AuthenticationError;
|
||||
|
||||
|
@ -86,7 +86,7 @@ impl StatusMessage {
|
|||
pub fn render<B: Backend>(status: Option<Self>, frame: &mut Frame<B>, area: Rect) {
|
||||
if let Some(status_message) = status {
|
||||
let widget = Paragraph::new(<&'static str>::from(status_message.clone())).style(
|
||||
tui::style::Style::default().fg(if status_message.is_error() {
|
||||
Style::default().fg(if status_message.is_error() {
|
||||
Color::Red
|
||||
} else {
|
||||
Color::Yellow
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crossterm::event::KeyCode;
|
||||
use log::warn;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
layout::{Alignment, Rect},
|
||||
style::Style,
|
||||
terminal::Frame,
|
||||
text::{Span, Spans, Text},
|
||||
text::{Span, Line, Text},
|
||||
widgets::{Block, Paragraph},
|
||||
};
|
||||
|
||||
|
@ -281,7 +281,7 @@ impl<T> SwitcherWidget<T> {
|
|||
|
||||
pub fn render(
|
||||
&self,
|
||||
frame: &mut Frame<impl tui::backend::Backend>,
|
||||
frame: &mut Frame<impl ratatui::backend::Backend>,
|
||||
area: Rect,
|
||||
is_focused: bool,
|
||||
) {
|
||||
|
@ -378,7 +378,7 @@ impl<T> SwitcherWidget<T> {
|
|||
));
|
||||
}
|
||||
|
||||
let text = Text::from(Spans::from(spans));
|
||||
let text = Text::from(Line::from(spans));
|
||||
let widget = Paragraph::new(text)
|
||||
.block(Block::default())
|
||||
.alignment(Alignment::Center);
|
||||
|
|
Loading…
Reference in a new issue