mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
fix some warnings
This commit is contained in:
parent
73aed04c64
commit
5c8cb8e413
1 changed files with 7 additions and 7 deletions
|
|
@ -15,7 +15,7 @@ pub struct Tui {
|
|||
exited: Arc<AtomicBool>,
|
||||
buffer: Buffer,
|
||||
backend: CrosstermBackend<Stdout>,
|
||||
area: [u16;4],
|
||||
area: [u16;4], // FIXME auto resize
|
||||
}
|
||||
impl Engine for Tui {
|
||||
type Unit = u16;
|
||||
|
|
@ -122,7 +122,7 @@ impl Tui {
|
|||
fn flip (&mut self, mut buffer: Buffer) -> Buffer {
|
||||
let updates = self.buffer.diff(&buffer);
|
||||
self.backend.draw(updates.into_iter()).expect("failed to render");
|
||||
self.backend.flush();
|
||||
self.backend.flush().expect("failed to flush output buffer");
|
||||
std::mem::swap(&mut self.buffer, &mut buffer);
|
||||
buffer.reset();
|
||||
buffer
|
||||
|
|
@ -280,13 +280,13 @@ pub fn buffer_update (buf: &mut Buffer, area: [u16;4], callback: &impl Fn(&mut C
|
|||
|
||||
impl Widget for &str {
|
||||
type Engine = Tui;
|
||||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
fn layout (&self, _: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
// TODO: line breaks
|
||||
Ok(Some([self.len() as u16, 1]))
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, ..] = to.area();
|
||||
let [w, h] = self.layout(to.area().wh())?.unwrap();
|
||||
//let [w, h] = self.layout(to.area().wh())?.unwrap();
|
||||
Ok(to.blit(&self, x, y, None))
|
||||
}
|
||||
}
|
||||
|
|
@ -295,13 +295,13 @@ pub struct Styled<T: Widget<Engine = Tui>>(pub Option<Style>, pub T);
|
|||
|
||||
impl Widget for Styled<&str> {
|
||||
type Engine = Tui;
|
||||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
fn layout (&self, _: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
Ok(Some([self.1.len() as u16, 1]))
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
// FIXME
|
||||
let [x, y, ..] = to.area();
|
||||
let [w, h] = self.layout(to.area().wh())?.unwrap();
|
||||
//let [w, h] = self.layout(to.area().wh())?.unwrap();
|
||||
Ok(to.blit(&self.1, x, y, None))
|
||||
}
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ pub struct Border<S: BorderStyle>(pub S);
|
|||
|
||||
impl<S: BorderStyle> Widget for Border<S> {
|
||||
type Engine = Tui;
|
||||
fn layout (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
fn layout (&self, _: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
Ok(Some([0, 0]))
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue