ui: fix bounds check in StatusBar

jmap
Manos Pitsidianakis 2019-11-19 20:40:28 +02:00
parent 0cea6368d9
commit 458f8da332
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 9 additions and 2 deletions

View File

@ -687,8 +687,15 @@ impl StatusBar {
None,
);
let offset = self.status.find('|').unwrap_or_else(|| self.status.len());
for x in get_x(upper_left!(area))..get_x(upper_left!(area)) + offset {
grid[(x, y)].set_attrs(Attr::Bold);
if y < get_y(bottom_right!(area)) + 1 {
for x in get_x(upper_left!(area))
..std::cmp::min(
get_x(upper_left!(area)) + offset,
get_x(bottom_right!(area)),
)
{
grid[(x, y)].set_attrs(Attr::Bold);
}
}
if self.cur_notification.is_some() {
let (t, n) = self.cur_notification.as_ref().unwrap();