mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
refactor: down to 50 errors
considering whether to implement layout methods on Area
This commit is contained in:
parent
06f8bd1116
commit
7bcd40b425
7 changed files with 77 additions and 86 deletions
|
|
@ -33,8 +33,8 @@ pub fn draw <'a, 'b> (
|
|||
cols: &'b [(usize, usize)],
|
||||
rows: &'b [(usize, usize)],
|
||||
) -> Perhaps<[u16;4]> {
|
||||
let mut area = to.area();
|
||||
area.height = 2 + (rows[rows.len() - 1].1 / 96) as u16;
|
||||
let area = to.area();
|
||||
let area = [area.x(), area.y(), area.w(), 2 + (rows[rows.len() - 1].1 / 96) as u16];
|
||||
let offset = 3 + scene_name_max_len(state.scenes.as_ref()) as u16;
|
||||
let tracks = state.tracks.as_ref();
|
||||
let scenes = state.scenes.as_ref();
|
||||
|
|
@ -57,8 +57,8 @@ impl<'a> Render<Tui> for ColumnSeparators<'a> {
|
|||
let Self(offset, cols) = self;
|
||||
let style = Some(Style::default().fg(Nord::SEPARATOR));
|
||||
for (_, x) in cols.iter() {
|
||||
let x = offset + area.x + *x as u16 - 1;
|
||||
for y in area.y..area.height+area.y {
|
||||
let x = offset + area.x() + *x as u16 - 1;
|
||||
for y in area.y()..area.y2() {
|
||||
to.blit(&"▎", x, y, style)?;
|
||||
}
|
||||
}
|
||||
|
|
@ -73,11 +73,11 @@ impl<'a> Render<Tui> for RowSeparators<'a> {
|
|||
let area = to.area();
|
||||
let Self(rows) = self;
|
||||
for (_, y) in rows.iter() {
|
||||
let y = area.y + (*y / 96) as u16 + 1;
|
||||
let y = area.y() + (*y / 96) as u16 + 1;
|
||||
if y >= to.buffer().area.height {
|
||||
break
|
||||
}
|
||||
for x in area.x..(area.width+area.y).saturating_sub(2) {
|
||||
for x in area.x()..area.x2().saturating_sub(2) {
|
||||
let cell = to.buffer().get_mut(x, y);
|
||||
cell.modifier = Modifier::UNDERLINED;
|
||||
cell.underline_color = Nord::SEPARATOR;
|
||||
|
|
@ -93,7 +93,7 @@ struct CursorFocus<'a>(
|
|||
|
||||
impl<'a> Render<Tui> for CursorFocus<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let mut area = to.area();
|
||||
let area = to.area();
|
||||
let Self(selected, offset, cols, rows) = *self;
|
||||
let get_track_area = |t: usize| [
|
||||
offset + area.x() + cols[t].1 as u16 - 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue