From c7523f03987445374928315e71b85e486a7bb072 Mon Sep 17 00:00:00 2001 From: Clemento Date: Tue, 26 May 2026 10:34:21 -0300 Subject: [PATCH] fix(ui): paint a solid background under modal popovers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The params-prompt and saved-query picker overlays were rendering on top of the editor, but `Block::style(bg)` only sets the cell style — it doesn't overwrite the glyph already in the buffer. That left the editor characters showing through the popover. Explicitly clear the popover rect and repaint with the theme bg before drawing the block. Bump to 0.17.1. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/ui/params_prompt_view.rs | 18 +++++++++++++++++- src/ui/saved_query_picker_view.rs | 14 +++++++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a825545..3fe1e31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2863,7 +2863,7 @@ dependencies = [ [[package]] name = "rowdy" -version = "0.17.0" +version = "0.17.1" dependencies = [ "anyhow", "arboard", diff --git a/Cargo.toml b/Cargo.toml index 58a7bb8..8d552f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rowdy" -version = "0.17.0" +version = "0.17.1" edition = "2024" rust-version = "1.86" license = "MIT" diff --git a/src/ui/params_prompt_view.rs b/src/ui/params_prompt_view.rs index b0ed264..416fbae 100644 --- a/src/ui/params_prompt_view.rs +++ b/src/ui/params_prompt_view.rs @@ -5,7 +5,7 @@ use ratatui::buffer::Buffer; use ratatui::layout::{Constraint, Layout, Rect}; use ratatui::style::{Modifier, Style}; use ratatui::text::{Line, Span}; -use ratatui::widgets::{Block, Borders, Paragraph, Widget, Wrap}; +use ratatui::widgets::{Block, Borders, Clear, Paragraph, Widget, Wrap}; use ratatui_textarea::TextArea; use crate::state::params_prompt::ParamsPromptState; @@ -31,6 +31,22 @@ impl Widget for ParamsPrompt<'_> { return; }; + // Wipe the cells under the popover first. Block::style only sets + // each cell's style — it doesn't overwrite the glyph — so without + // an explicit Clear the editor's characters show through the + // popover background. + Clear.render(box_area, buf); + // Repaint with the theme bg so the cleared cells aren't terminal + // default (which can be transparent in some emulators). + for y in box_area.y..box_area.y + box_area.height { + for x in box_area.x..box_area.x + box_area.width { + if let Some(cell) = buf.cell_mut((x, y)) { + cell.set_bg(self.theme.bg); + cell.set_fg(self.theme.fg); + } + } + } + let block = Block::default() .borders(Borders::ALL) .border_style( diff --git a/src/ui/saved_query_picker_view.rs b/src/ui/saved_query_picker_view.rs index c0845dd..66029a3 100644 --- a/src/ui/saved_query_picker_view.rs +++ b/src/ui/saved_query_picker_view.rs @@ -2,7 +2,7 @@ use ratatui::buffer::Buffer; use ratatui::layout::{Constraint, Layout, Rect}; use ratatui::style::{Modifier, Style}; use ratatui::text::{Line, Span}; -use ratatui::widgets::{Block, Borders, Paragraph, Widget, Wrap}; +use ratatui::widgets::{Block, Borders, Clear, Paragraph, Widget, Wrap}; use crate::state::saved_query_picker::SavedQueryPickerState; use crate::ui::theme::Theme; @@ -18,6 +18,18 @@ impl Widget for SavedQueryPicker<'_> { let Some(box_area) = inner_box(area, self.state.entries.len()) else { return; }; + // Wipe + repaint the box cells so the editor underneath doesn't + // show through. Block::style only sets style on inner cells, it + // doesn't overwrite the glyphs already there. + Clear.render(box_area, buf); + for y in box_area.y..box_area.y + box_area.height { + for x in box_area.x..box_area.x + box_area.width { + if let Some(cell) = buf.cell_mut((x, y)) { + cell.set_bg(self.theme.bg); + cell.set_fg(self.theme.fg); + } + } + } let title = match self.connection { Some(c) => format!(" run saved query — {c} "), None => " run saved query ".to_string(),