mirror of
https://github.com/imsnif/bandwhich.git
synced 2026-02-09 01:59:18 +08:00
Fix breaking changes of ratatui 0.28.0
See https://github.com/ratatui/ratatui/blob/main/BREAKING-CHANGES.md#v0280
This commit is contained in:
@@ -3,9 +3,9 @@ use std::time::{Duration, Instant};
|
||||
use ratatui::{
|
||||
layout::{Alignment, Rect},
|
||||
style::{Color, Modifier, Style},
|
||||
terminal::Frame,
|
||||
text::Span,
|
||||
widgets::Paragraph,
|
||||
Frame,
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use ratatui::{
|
||||
layout::{Alignment, Rect},
|
||||
style::{Modifier, Style},
|
||||
terminal::Frame,
|
||||
text::Span,
|
||||
widgets::Paragraph,
|
||||
Frame,
|
||||
};
|
||||
|
||||
pub struct HelpText {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use ratatui::{
|
||||
layout::{Constraint, Direction, Rect},
|
||||
terminal::Frame,
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::display::{HeaderDetails, HelpText, Table};
|
||||
|
||||
@@ -5,8 +5,8 @@ use itertools::Itertools;
|
||||
use ratatui::{
|
||||
layout::{Constraint, Rect},
|
||||
style::{Color, Style},
|
||||
terminal::Frame,
|
||||
widgets::{Block, Borders, Row},
|
||||
Frame,
|
||||
};
|
||||
use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use std::io;
|
||||
use ratatui::{
|
||||
backend::{Backend, WindowSize},
|
||||
buffer::Cell,
|
||||
layout::{Rect, Size},
|
||||
layout::{Position, Size},
|
||||
};
|
||||
|
||||
pub struct RawTerminalBackend {}
|
||||
@@ -31,11 +31,11 @@ impl Backend for RawTerminalBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
|
||||
Ok((0, 0))
|
||||
fn get_cursor_position(&mut self) -> io::Result<Position> {
|
||||
Ok(Position::new(0, 0))
|
||||
}
|
||||
|
||||
fn set_cursor(&mut self, _x: u16, _y: u16) -> io::Result<()> {
|
||||
fn set_cursor_position<P: Into<Position>>(&mut self, _position: P) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ impl Backend for RawTerminalBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn size(&self) -> io::Result<Rect> {
|
||||
Ok(Rect::new(0, 0, 0, 0))
|
||||
fn size(&self) -> io::Result<Size> {
|
||||
Ok(Size::new(0, 0))
|
||||
}
|
||||
|
||||
fn window_size(&mut self) -> io::Result<WindowSize> {
|
||||
|
||||
@@ -137,7 +137,7 @@ where
|
||||
footer: HelpText { paused, show_dns },
|
||||
};
|
||||
self.terminal
|
||||
.draw(|frame| layout.render(frame, frame.size(), ui_offset))
|
||||
.draw(|frame| layout.render(frame, frame.area(), ui_offset))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::{
|
||||
use ratatui::{
|
||||
backend::{Backend, WindowSize},
|
||||
buffer::Cell,
|
||||
layout::{Rect, Size},
|
||||
layout::{Position, Size},
|
||||
};
|
||||
|
||||
#[derive(Hash, Debug, PartialEq)]
|
||||
@@ -65,12 +65,12 @@ impl Backend for TestBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
|
||||
fn get_cursor_position(&mut self) -> io::Result<Position> {
|
||||
self.events.lock().unwrap().push(TerminalEvent::GetCursor);
|
||||
Ok((0, 0))
|
||||
Ok(Position::new(0, 0))
|
||||
}
|
||||
|
||||
fn set_cursor(&mut self, _x: u16, _y: u16) -> io::Result<()> {
|
||||
fn set_cursor_position<P: Into<Position>>(&mut self, _position: P) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -106,11 +106,11 @@ impl Backend for TestBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn size(&self) -> io::Result<Rect> {
|
||||
fn size(&self) -> io::Result<Size> {
|
||||
let terminal_height = self.terminal_height.lock().unwrap();
|
||||
let terminal_width = self.terminal_width.lock().unwrap();
|
||||
|
||||
Ok(Rect::new(0, 0, *terminal_width, *terminal_height))
|
||||
Ok(Size::new(*terminal_width, *terminal_height))
|
||||
}
|
||||
|
||||
fn window_size(&mut self) -> io::Result<WindowSize> {
|
||||
|
||||
Reference in New Issue
Block a user