diff options
Diffstat (limited to 'ui/src/components.rs')
-rw-r--r-- | ui/src/components.rs | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/ui/src/components.rs b/ui/src/components.rs index f19bcf99..dd3febb7 100644 --- a/ui/src/components.rs +++ b/ui/src/components.rs @@ -90,7 +90,7 @@ pub trait Component: Display + Debug + Send { fn is_visible(&self) -> bool { true } - fn can_quit_cleanly(&mut self) -> bool { + fn can_quit_cleanly(&mut self, _context: &Context) -> bool { true } fn set_dirty(&mut self); @@ -374,6 +374,17 @@ pub(crate) fn set_and_join_box(grid: &mut CellBuffer, idx: Pos, ch: char) { * 0b____ */ + if grid.ascii_drawing { + grid[idx].set_ch(match ch { + '│' => '|', + '─' => '-', + _ => unreachable!(), + }); + + grid[idx].set_fg(Color::Byte(240)); + return; + } + let bin_set = match ch { '│' => set_and_join_vert(grid, idx), '─' => set_and_join_horz(grid, idx), @@ -391,19 +402,21 @@ pub fn create_box(grid: &mut CellBuffer, area: Area) { let upper_left = upper_left!(area); let bottom_right = bottom_right!(area); - for x in get_x(upper_left)..get_x(bottom_right) { - grid[(x, get_y(upper_left))].set_ch(HORZ_BOUNDARY); - grid[(x, get_y(bottom_right))].set_ch(HORZ_BOUNDARY); - grid[(x, get_y(bottom_right))].set_fg(Color::Byte(240)); - } + if !grid.ascii_drawing { + for x in get_x(upper_left)..get_x(bottom_right) { + grid[(x, get_y(upper_left))].set_ch(HORZ_BOUNDARY); + grid[(x, get_y(bottom_right))].set_ch(HORZ_BOUNDARY); + grid[(x, get_y(bottom_right))].set_fg(Color::Byte(240)); + } - for y in get_y(upper_left)..get_y(bottom_right) { - grid[(get_x(upper_left), y)].set_ch(VERT_BOUNDARY); - grid[(get_x(bottom_right), y)].set_ch(VERT_BOUNDARY); - grid[(get_x(bottom_right), y)].set_fg(Color::Byte(240)); + for y in get_y(upper_left)..get_y(bottom_right) { + grid[(get_x(upper_left), y)].set_ch(VERT_BOUNDARY); + grid[(get_x(bottom_right), y)].set_ch(VERT_BOUNDARY); + grid[(get_x(bottom_right), y)].set_fg(Color::Byte(240)); + } + set_and_join_box(grid, upper_left, HORZ_BOUNDARY); + set_and_join_box(grid, set_x(upper_left, get_x(bottom_right)), HORZ_BOUNDARY); + set_and_join_box(grid, set_y(upper_left, get_y(bottom_right)), VERT_BOUNDARY); + set_and_join_box(grid, bottom_right, VERT_BOUNDARY); } - set_and_join_box(grid, upper_left, HORZ_BOUNDARY); - set_and_join_box(grid, set_x(upper_left, get_x(bottom_right)), HORZ_BOUNDARY); - set_and_join_box(grid, set_y(upper_left, get_y(bottom_right)), VERT_BOUNDARY); - set_and_join_box(grid, bottom_right, VERT_BOUNDARY); } |