mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-10 07:04:17 +00:00
chore: Update deps (#51)
* Update deps Also, temporarily disabled clippy check. Can be discussed in #49. * Fix termion demo * chore: fix all clippy warnings * Call into_raw_mode() * Update min supported rust version --------- Co-authored-by: rhysd <lin90162@yahoo.co.jp>
This commit is contained in:
parent
9534d533e3
commit
9feda988a5
8 changed files with 19 additions and 16 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
rust: ["1.56.1", "stable"]
|
||||
rust: ["1.59.0", "stable"]
|
||||
steps:
|
||||
- uses: hecrj/setup-rust-action@967aec96c6a27a0ce15c1dac3aaba332d60565e2
|
||||
with:
|
||||
|
@ -45,7 +45,7 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
rust: ["1.56.1", "stable"]
|
||||
rust: ["1.59.0", "stable"]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: hecrj/setup-rust-action@967aec96c6a27a0ce15c1dac3aaba332d60565e2
|
||||
|
|
|
@ -23,10 +23,10 @@ default = ["crossterm"]
|
|||
[dependencies]
|
||||
bitflags = "1.3"
|
||||
cassowary = "0.3"
|
||||
unicode-segmentation = "1.2"
|
||||
unicode-segmentation = "1.10"
|
||||
unicode-width = "0.1"
|
||||
termion = { version = "1.5", optional = true }
|
||||
crossterm = { version = "0.25", optional = true }
|
||||
termion = { version = "2.0", optional = true }
|
||||
crossterm = { version = "0.26", optional = true }
|
||||
serde = { version = "1", optional = true, features = ["derive"]}
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -15,8 +15,8 @@ dependencies = [
|
|||
"check-termion",
|
||||
"test-crossterm",
|
||||
"test-termion",
|
||||
"clippy-crossterm",
|
||||
"clippy-termion",
|
||||
# "clippy-crossterm", TODO: re-enable
|
||||
# "clippy-termion", TODO: re-enable
|
||||
"test-doc",
|
||||
]
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ you may rely on the previously cited libraries to achieve such features.
|
|||
|
||||
## Rust version requirements
|
||||
|
||||
Since version 0.17.0, `tui` requires **rustc version 1.56.1 or greater**.
|
||||
Since version 0.17.0, `tui` requires **rustc version 1.59.0 or greater**.
|
||||
|
||||
# Documentation
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use termion::{
|
|||
event::Key,
|
||||
input::{MouseTerminal, TermRead},
|
||||
raw::IntoRawMode,
|
||||
screen::AlternateScreen,
|
||||
screen::IntoAlternateScreen,
|
||||
};
|
||||
use tui::{
|
||||
backend::{Backend, TermionBackend},
|
||||
|
@ -13,9 +13,12 @@ use tui::{
|
|||
|
||||
pub fn run(tick_rate: Duration, enhanced_graphics: bool) -> Result<(), Box<dyn Error>> {
|
||||
// setup terminal
|
||||
let stdout = io::stdout().into_raw_mode()?;
|
||||
let stdout = io::stdout()
|
||||
.into_raw_mode()
|
||||
.unwrap()
|
||||
.into_alternate_screen()
|
||||
.unwrap();
|
||||
let stdout = MouseTerminal::from(stdout);
|
||||
let stdout = AlternateScreen::from(stdout);
|
||||
let backend = TermionBackend::new(stdout);
|
||||
let mut terminal = Terminal::new(backend)?;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ fn main() -> Result<()> {
|
|||
reset_terminal()?;
|
||||
|
||||
if let Err(err) = res {
|
||||
println!("{:?}", err);
|
||||
println!("{err:?}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -306,7 +306,7 @@ impl Buffer {
|
|||
(x_offset as u16, y)
|
||||
}
|
||||
|
||||
pub fn set_spans<'a>(&mut self, x: u16, y: u16, spans: &Spans<'a>, width: u16) -> (u16, u16) {
|
||||
pub fn set_spans(&mut self, x: u16, y: u16, spans: &Spans<'_>, width: u16) -> (u16, u16) {
|
||||
let mut remaining_width = width;
|
||||
let mut x = x;
|
||||
for span in &spans.0 {
|
||||
|
@ -327,7 +327,7 @@ impl Buffer {
|
|||
(x, y)
|
||||
}
|
||||
|
||||
pub fn set_span<'a>(&mut self, x: u16, y: u16, span: &Span<'a>, width: u16) -> (u16, u16) {
|
||||
pub fn set_span(&mut self, x: u16, y: u16, span: &Span<'_>, width: u16) -> (u16, u16) {
|
||||
self.set_stringn(x, y, span.content.as_ref(), width as usize, span.style)
|
||||
}
|
||||
|
||||
|
|
|
@ -243,11 +243,11 @@ impl<'a> StatefulWidget for List<'a> {
|
|||
list_area.width as usize,
|
||||
item_style,
|
||||
);
|
||||
(elem_x, (list_area.width - (elem_x - x)) as u16)
|
||||
(elem_x, (list_area.width - (elem_x - x)))
|
||||
} else {
|
||||
(x, list_area.width)
|
||||
};
|
||||
buf.set_spans(elem_x, y + j as u16, line, max_element_width as u16);
|
||||
buf.set_spans(elem_x, y + j as u16, line, max_element_width);
|
||||
}
|
||||
if is_selected {
|
||||
buf.set_style(area, self.highlight_style);
|
||||
|
|
Loading…
Reference in a new issue