diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2024-01-02 01:13:02 -0500 |
---|---|---|
committer | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2024-01-02 01:13:02 -0500 |
commit | c730048c7a0a5ab2eb657fee2649d7b22e73652d (patch) | |
tree | e75b7e0e03f64e797bcc5a85195a2ffe8728cdb7 /src/canvas.rs | |
parent | dbadbb996cb8d55d842b9632126c031f39596453 (diff) |
temp worktuine_yet_again
Diffstat (limited to 'src/canvas.rs')
-rw-r--r-- | src/canvas.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/canvas.rs b/src/canvas.rs index 38194f04..741b4400 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -55,11 +55,12 @@ impl FromStr for ColourScheme { } } -/// Handles the canvas' state. +/// Handles some state used while painting. pub struct Painter { pub colours: CanvasStyling, - height: u16, - width: u16, + + prev_height: u16, + prev_width: u16, styled_help_text: Vec<Line<'static>>, // TODO: Redo this entire thing. @@ -153,8 +154,8 @@ impl Painter { let mut painter = Painter { colours: styling, - height: 0, - width: 0, + prev_height: 0, + prev_width: 0, styled_help_text: Vec::default(), row_constraints, col_constraints, @@ -244,12 +245,12 @@ impl Painter { let terminal_height = terminal_size.height; let terminal_width = terminal_size.width; - if (self.height == 0 && self.width == 0) - || (self.height != terminal_height || self.width != terminal_width) + if (self.prev_height == 0 && self.prev_width == 0) + || (self.prev_height != terminal_height || self.prev_width != terminal_width) { app_state.is_force_redraw = true; - self.height = terminal_height; - self.width = terminal_width; + self.prev_height = terminal_height; + self.prev_width = terminal_width; } if app_state.should_get_widget_bounds() { |