diff options
Diffstat (limited to 'ui/src/components/mod.rs')
-rw-r--r-- | ui/src/components/mod.rs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/ui/src/components/mod.rs b/ui/src/components/mod.rs index d4ecb6d5..179f989c 100644 --- a/ui/src/components/mod.rs +++ b/ui/src/components/mod.rs @@ -36,7 +36,7 @@ pub mod utilities; pub use self::utilities::*; use std::fmt; -use std::fmt::{Display, Debug}; +use std::fmt::{Debug, Display}; use std::ops::Deref; use super::{Key, UIEvent, UIEventType}; @@ -76,7 +76,6 @@ impl Display for Entity { } } - impl Deref for Entity { type Target = Box<Component>; @@ -227,22 +226,22 @@ fn write_string_to_grid( eprintln!(" Invalid area with string {} and area {:?}", s, area); return (x, y); } - 'char: for c in s.chars() { - grid[(x, y)].set_ch(c); - grid[(x, y)].set_fg(fg_color); - grid[(x, y)].set_bg(bg_color); - x += 1; + 'char: for c in s.chars() { + grid[(x, y)].set_ch(c); + grid[(x, y)].set_fg(fg_color); + grid[(x, y)].set_bg(bg_color); + x += 1; - if x == (get_x(bottom_right)) + 1 || x > get_x(bounds) { - x = get_x(upper_left); - y += 1; - if y > (get_y(bottom_right)) || y > get_y(bounds) { - return (x, y - 1); - } - if !line_break { - break 'char; - } + if x == (get_x(bottom_right)) + 1 || x > get_x(bounds) { + x = get_x(upper_left); + y += 1; + if y > (get_y(bottom_right)) || y > get_y(bounds) { + return (x, y - 1); + } + if !line_break { + break 'char; } + } } (x, y) } |