ui: make StatusPanel grid growable

jmap
Manos Pitsidianakis 2019-11-11 17:59:36 +02:00
parent 776dc107c2
commit 1d6ef92a4f
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
2 changed files with 15 additions and 10 deletions

View File

@ -225,7 +225,8 @@ impl Component for StatusPanel {
impl StatusPanel { impl StatusPanel {
pub fn new() -> StatusPanel { pub fn new() -> StatusPanel {
let content = CellBuffer::new(120, 40, Cell::default()); let mut content = CellBuffer::new(120, 40, Cell::default());
content.set_growable(true);
StatusPanel { StatusPanel {
cursor: (0, 0), cursor: (0, 0),

View File

@ -765,17 +765,21 @@ macro_rules! inspect_bounds {
let bounds = $grid.size(); let bounds = $grid.size();
let (upper_left, bottom_right) = $area; let (upper_left, bottom_right) = $area;
if $x > (get_x(bottom_right)) || $x > get_x(bounds) { if $x > (get_x(bottom_right)) || $x > get_x(bounds) {
$x = get_x(upper_left); if $grid.growable {
$y += 1; $grid.resize($grid.cols * 2, $grid.rows, Cell::default());
if $y > (get_y(bottom_right)) || $y > get_y(bounds) { } else {
if $grid.growable { $x = get_x(upper_left);
$grid.resize($grid.cols, $grid.rows * 2, Cell::default()); $y += 1;
} else { if !$line_break {
return ($x, $y - 1); break;
} }
} }
if !$line_break { }
break; if $y > (get_y(bottom_right)) || $y > get_y(bounds) {
if $grid.growable {
$grid.resize($grid.cols, $grid.rows * 2, Cell::default());
} else {
return ($x, $y - 1);
} }
} }
}; };