wip: cleanup, begin reconnecting ports

This commit is contained in:
🪞👃🪞 2025-01-09 18:31:42 +01:00
parent e8430c373f
commit 0cca06e054
5 changed files with 41 additions and 29 deletions

View file

@ -1,5 +1,17 @@
use crate::*;
pub fn buffer_update (buf: &mut Buffer, area: [u16;4], callback: &impl Fn(&mut Cell, u16, u16)) {
for row in 0..area.h() {
let y = area.y() + row;
for col in 0..area.w() {
let x = area.x() + col;
if x < buf.area.width && y < buf.area.height {
callback(buf.get_mut(x, y), col, row);
}
}
}
}
#[derive(Default)]
pub struct BigBuffer {
pub width: usize,

View file

@ -2,9 +2,9 @@ use crate::*;
pub struct Tui {
pub exited: Arc<AtomicBool>,
pub buffer: Buffer,
pub backend: CrosstermBackend<Stdout>,
pub area: [u16;4], // FIXME auto resize
pub buffer: Buffer,
pub area: [u16;4],
}
impl Tui {

View file

@ -79,23 +79,3 @@ pub fn buffer_update (buf: &mut Buffer, area: [u16;4], callback: &impl Fn(&mut C
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//impl Area<u16> for Rect {
//fn x (&self) -> u16 { self.x }
//fn y (&self) -> u16 { self.y }
//fn w (&self) -> u16 { self.width }
//fn h (&self) -> u16 { self.height }
//}
pub fn half_block (lower: bool, upper: bool) -> Option<char> {
match (lower, upper) {
(true, true) => Some('█'),
(true, false) => Some('▄'),
(false, true) => Some('▀'),
_ => None
}
}
//impl<T: Content<TuiOut>> Render<TuiOut> for T {}