Skip to content

Commit dbd0c7f

Browse files
committed
chore: Bump ratatui to the latest version
1 parent d21212a commit dbd0c7f

File tree

8 files changed

+105
-61
lines changed

8 files changed

+105
-61
lines changed

Cargo.lock

Lines changed: 66 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include = ["src/**/*", "Cargo.*", "LICENSE", "README.md", "CHANGELOG.md"]
1414
edition = "2021"
1515

1616
[dependencies]
17-
tui = { package = "ratatui", version = "0.23.0", default-features = false, features = ["termion"] }
17+
ratatui = { version = "0.24.0", default-features = false, features = ["termion"] }
1818
termion = "2.0.1"
1919
bytesize = "1.3.0"
2020
unicode-width = "0.1.11"

src/app.rs

Lines changed: 28 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@ use crate::widgets::StatefulList;
99
use copypasta_ext::display::DisplayServer as ClipboardDisplayServer;
1010
use copypasta_ext::ClipboardProviderExt;
1111
use enum_iterator::Sequence;
12+
use ratatui::layout::{Alignment, Constraint, Direction, Layout, Rect};
13+
use ratatui::style::Style as TuiStyle;
14+
use ratatui::text::{Line, Span, Text};
15+
use ratatui::widgets::{
16+
Block as TuiBlock, Borders, Clear, List, ListItem, Paragraph, Row, Table, Wrap,
17+
};
18+
use ratatui::Frame;
1219
use std::fmt::{Debug, Display, Formatter};
1320
use std::slice::Iter;
1421
use std::sync::mpsc::Sender;
1522
use termion::event::Key;
16-
use tui::backend::Backend;
17-
use tui::layout::{Alignment, Constraint, Direction, Layout, Rect};
18-
use tui::style::Style as TuiStyle;
19-
use tui::text::{Line, Span, Text};
20-
use tui::widgets::{
21-
Block as TuiBlock, Borders, Clear, List, ListItem, Paragraph, Row, Table, Wrap,
22-
};
23-
use tui::Frame;
2423
use unicode_width::UnicodeWidthStr;
2524

2625
/* Table header of the module table */
@@ -325,14 +324,12 @@ impl App {
325324
* @param area
326325
* @param kernel
327326
*/
328-
pub fn draw_dynamic_block<B>(
327+
pub fn draw_dynamic_block(
329328
&mut self,
330-
frame: &mut Frame<'_, B>,
329+
frame: &mut Frame,
331330
area: Rect,
332331
kernel: &mut Kernel,
333-
) where
334-
B: Backend,
335-
{
332+
) {
336333
match self.block_index {
337334
0 => self.draw_kernel_modules(frame, area, &mut kernel.modules),
338335
1 => self.draw_module_info(frame, area, &mut kernel.modules),
@@ -352,14 +349,12 @@ impl App {
352349
* @param area
353350
* @param tx
354351
*/
355-
pub fn draw_user_input<B>(
352+
pub fn draw_user_input(
356353
&self,
357-
frame: &mut Frame<'_, B>,
354+
frame: &mut Frame,
358355
area: Rect,
359356
tx: &Sender<Event<Key>>,
360-
) where
361-
B: Backend,
362-
{
357+
) {
363358
frame.render_widget(
364359
Paragraph::new(Span::raw(self.input_query.to_string()))
365360
.block(
@@ -399,14 +394,7 @@ impl App {
399394
* @param area
400395
* @param info
401396
*/
402-
pub fn draw_kernel_info<B>(
403-
&self,
404-
frame: &mut Frame<'_, B>,
405-
area: Rect,
406-
info: &[String],
407-
) where
408-
B: Backend,
409-
{
397+
pub fn draw_kernel_info(&self, frame: &mut Frame, area: Rect, info: &[String]) {
410398
frame.render_widget(
411399
Paragraph::new(Span::raw(&info[1]))
412400
.block(
@@ -436,14 +424,12 @@ impl App {
436424
* @param area
437425
* @param kernel_modules
438426
*/
439-
pub fn draw_kernel_modules<B>(
427+
pub fn draw_kernel_modules(
440428
&mut self,
441-
frame: &mut Frame<'_, B>,
429+
frame: &mut Frame,
442430
area: Rect,
443431
kernel_modules: &mut KernelModules<'_>,
444-
) where
445-
B: Backend,
446-
{
432+
) {
447433
/* Filter the module list depending on the input query. */
448434
let mut kernel_module_list = kernel_modules.default_list.clone();
449435
if (self.input_mode == InputMode::None
@@ -540,14 +526,12 @@ impl App {
540526
* @param frame
541527
* @param area
542528
*/
543-
pub fn draw_options_menu<B>(
529+
pub fn draw_options_menu(
544530
&mut self,
545-
frame: &mut Frame<'_, B>,
531+
frame: &mut Frame,
546532
area: Rect,
547533
kernel_modules: &mut KernelModules<'_>,
548-
) where
549-
B: Backend,
550-
{
534+
) {
551535
let block_title = format!(
552536
"Options ({})",
553537
kernel_modules.list[kernel_modules.index][0]
@@ -626,14 +610,12 @@ impl App {
626610
* @param area
627611
* @param kernel_modules
628612
*/
629-
pub fn draw_module_info<B>(
613+
pub fn draw_module_info(
630614
&self,
631-
frame: &mut Frame<'_, B>,
615+
frame: &mut Frame,
632616
area: Rect,
633617
kernel_modules: &mut KernelModules<'_>,
634-
) where
635-
B: Backend,
636-
{
618+
) {
637619
frame.render_widget(
638620
Paragraph::new(kernel_modules.current_info.get())
639621
.block(
@@ -676,14 +658,12 @@ impl App {
676658
* @param area
677659
* @param kernel_logs
678660
*/
679-
pub fn draw_kernel_activities<B>(
661+
pub fn draw_kernel_activities(
680662
&self,
681-
frame: &mut Frame<'_, B>,
663+
frame: &mut Frame,
682664
area: Rect,
683665
kernel_logs: &mut KernelLogs,
684-
) where
685-
B: Backend,
686-
{
666+
) {
687667
frame.render_widget(
688668
Paragraph::new(StyledText::default().stylize_data(
689669
kernel_logs.select(area.height, 2),
@@ -715,8 +695,8 @@ mod tests {
715695
use crate::kernel::info;
716696
use crate::kernel::lkm::ListArgs;
717697
use clap::ArgMatches;
718-
use tui::backend::TestBackend;
719-
use tui::Terminal;
698+
use ratatui::backend::TestBackend;
699+
use ratatui::Terminal;
720700
#[test]
721701
fn test_app() {
722702
let args = ArgMatches::default();

src/kernel/lkm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use crate::style::{Style, StyledText, Symbol};
44
use crate::util;
55
use bytesize::ByteSize;
66
use clap::ArgMatches;
7+
use ratatui::text::{Line, Span, Text};
78
use std::slice::Iter;
8-
use tui::text::{Line, Span, Text};
99

1010
/* Type of the sorting of module list */
1111
#[derive(Clone, Copy, Debug)]

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use crate::kernel::cmd::ModuleCommand;
1414
use crate::kernel::Kernel;
1515
use enum_iterator::Sequence;
1616
use event::{Event, Events};
17+
use ratatui::backend::Backend;
18+
use ratatui::layout::{Constraint, Direction, Layout};
19+
use ratatui::Terminal;
1720
use std::error::Error;
1821
use termion::event::Key;
19-
use tui::backend::Backend;
20-
use tui::layout::{Constraint, Direction, Layout};
21-
use tui::Terminal;
2222
use unicode_width::UnicodeWidthStr;
2323

2424
/**
@@ -561,10 +561,10 @@ where
561561
mod tests {
562562
use super::*;
563563
use clap::ArgMatches;
564+
use ratatui::backend::TestBackend;
564565
use std::sync::mpsc::Sender;
565566
use std::thread;
566567
use std::time::Duration;
567-
use tui::backend::TestBackend;
568568
#[test]
569569
fn test_tui() -> Result<(), Box<dyn Error>> {
570570
let args = ArgMatches::default();

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use kmon::args;
22
use kmon::event::Events;
33
use kmon::kernel::Kernel;
4+
use ratatui::backend::TermionBackend;
5+
use ratatui::Terminal;
46
use std::error::Error;
57
use std::io::stdout;
68
use termion::input::MouseTerminal;
79
use termion::raw::IntoRawMode;
810
use termion::screen::IntoAlternateScreen;
9-
use tui::backend::TermionBackend;
10-
use tui::Terminal;
1111

1212
/**
1313
* Entry point.

src/style.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use clap::ArgMatches;
22
use colorsys::Rgb;
3+
use ratatui::style::{Color, Modifier, Style as TuiStyle};
4+
use ratatui::text::{Line, Span, Text};
35
use std::collections::HashMap;
4-
use tui::style::{Color, Modifier, Style as TuiStyle};
5-
use tui::text::{Line, Span, Text};
66

77
/* Unicode symbol */
88
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]

src/widgets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use tui::widgets::ListState;
1+
use ratatui::widgets::ListState;
22

33
/// List widget with TUI controlled states.
44
#[derive(Debug)]

0 commit comments

Comments
 (0)