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 {
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 {
cursor: (0, 0),

View File

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