Skip to content

Commit

Permalink
fix: clear UI before rendering anything for sanitizing
Browse files Browse the repository at this point in the history
There is a flaky bug that, sometimes, the background color of texts
renders differs from the background without rendered texts, as if the
background color gets "stale". This bug is considered flaky, as no
contributor/maintainer could reproduce, but they are consistent in
a user setup.

To try solving this issue, clear the whole UI using the `ratatui`
widget `Clear`, which does exactly what the name entails, before
rendering anything.

Signed-off-by: Thiago Duvanel <thiago.duvanel@usp.br>
Reviewed-by: David Tadokoro <davidbtadokoro@usp.br>
Signed-off-by: David Tadokoro <davidbtadokoro@usp.br>
  • Loading branch information
th-duvanel authored and davidbtadokoro committed Jan 29, 2025
1 parent 51f7066 commit 2a8a695
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ratatui::{
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
text::Text,
widgets::{Block, Borders, Paragraph},
widgets::{Block, Borders, Clear, Paragraph},
Frame,
};

Expand All @@ -17,6 +17,9 @@ mod navigation_bar;
pub mod popup;

pub fn draw_ui(f: &mut Frame, app: &App) {
// Clear the whole screen for sanitizing reasons
f.render_widget(Clear, f.area());

let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
Expand Down

0 comments on commit 2a8a695

Please sign in to comment.