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:
Arijit Basu 2023-02-15 18:29:50 +05:30 committed by GitHub
parent 9534d533e3
commit 9feda988a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 16 deletions

View file

@ -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

View file

@ -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]

View file

@ -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",
]

View file

@ -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

View file

@ -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)?;

View file

@ -59,7 +59,7 @@ fn main() -> Result<()> {
reset_terminal()?;
if let Err(err) = res {
println!("{:?}", err);
println!("{err:?}");
}
Ok(())

View file

@ -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)
}

View file

@ -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);