From 670485e8c725344d0107cc854a8bbdbc64285034 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Fri, 28 Feb 2020 09:15:11 +0200 Subject: [PATCH] compose: clear bounds of compose area properly --- src/components/mail/compose.rs | 36 ++++++++++++++--------------- src/components/utilities/widgets.rs | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/components/mail/compose.rs b/src/components/mail/compose.rs index 65cc6ff8..910d1dbe 100644 --- a/src/components/mail/compose.rs +++ b/src/components/mail/compose.rs @@ -456,27 +456,25 @@ impl Component for Composer { Color::Byte(189), Color::Byte(167), ); - if mid != 0 { - clear_area( - grid, + clear_area( + grid, + ( + pos_dec(upper_left, (0, 1)), + set_x(bottom_right, get_x(upper_left) + mid), + ), + theme_default, + ); + clear_area( + grid, + ( ( - pos_dec(upper_left, (0, 1)), - set_x(bottom_right, get_x(upper_left) + mid), + get_x(bottom_right).saturating_sub(mid), + get_y(upper_left) - 1, ), - theme_default, - ); - clear_area( - grid, - ( - ( - get_x(bottom_right).saturating_sub(mid), - get_y(upper_left) - 1, - ), - bottom_right, - ), - theme_default, - ); - } + bottom_right, + ), + theme_default, + ); /* Regardless of view mode, do the following */ self.form.draw(grid, header_area, context); diff --git a/src/components/utilities/widgets.rs b/src/components/utilities/widgets.rs index de6bafd6..0eeefa0e 100644 --- a/src/components/utilities/widgets.rs +++ b/src/components/utilities/widgets.rs @@ -443,7 +443,7 @@ impl Component for FormWidget { } for row in grid.bounds_iter(( pos_inc(upper_left, (0, i)), - set_y(bottom_right, i + get_y(upper_left)), + (get_x(bottom_right).saturating_sub(1), i + get_y(upper_left)), )) { for c in row { grid[c]