From 59796d9ab0c85f55051b0db2e6205f9c1439409e Mon Sep 17 00:00:00 2001 From: Valdemar Lorenzen Date: Mon, 19 Oct 2026 15:38:31 +0200 Subject: [PATCH] fix: preserve terminal background between bar elements --- TODO.md | 4 +++- src/connection.rs | 28 +++++++++++++++++++++++++++- src/main.rs | 1 + 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 4628698..bc43590 100644 --- a/TODO.md +++ b/TODO.md @@ -14,4 +14,6 @@ - [x] use the proper ending character in the family of `├` instead of that character all the way down. - [x] remove this top-most line above the panels on the right-hand side: `dbdash │ SQLite │ READ ONLY`. - [x] highlight the current cell isntead of just the current row in the results pane. -- [x] put the help text inside it's own pane so it fits the design more cleanly. \ No newline at end of file +- [x] put the help text inside it's own pane so it fits the design more cleanly. +- [ ] move the table name in the results pane from the bottom-left border title to top-right border title instead +- [ ] remove the bottom navigation help panel and have a keybinding overview appear in a floating window when pressing `?` in normal mode \ No newline at end of file diff --git a/src/connection.rs b/src/connection.rs index 0e24636..6cc3672 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -354,7 +354,7 @@ fn draw_bars( insert: bool, position: Option<(usize, usize)>, ) { - let base = Style::default().bg(Color::DarkGray).fg(Color::White); + let base = Style::default(); let badge = Style::default().bg(Color::Cyan).fg(Color::Black); let edge = base.fg(Color::Cyan); frame.render_widget( @@ -1060,6 +1060,32 @@ mod tests { assert!(form.input().is_some()); } + #[test] + fn bar_background_is_default_outside_badges() -> Result<()> { + let mut terminal = ratatui::Terminal::new(ratatui::backend::TestBackend::new(80, 8))?; + terminal.draw(|frame| { + let [top, _, bottom] = shell_areas(frame.area()); + draw_bars( + frame, + top, + bottom, + "SQLite", + "example.sqlite", + false, + Some((1, 1)), + ); + })?; + let buffer = terminal.backend().buffer(); + for y in [0, 7] { + for x in [9, 20, 40, 60] { + assert_eq!(buffer[(x, y)].bg, Color::Reset); + } + assert_eq!(buffer[(0, y)].bg, Color::Cyan); + } + assert_eq!(buffer[(79, 7)].bg, Color::Cyan); + Ok(()) + } + #[test] fn shell_keeps_position_when_name_is_long_and_yields_on_short_screens() -> Result<()> { let mut terminal = ratatui::Terminal::new(ratatui::backend::TestBackend::new(24, 8))?; diff --git a/src/main.rs b/src/main.rs index 630003e..36100fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,6 +43,7 @@ Navigation: Enter on the connected database collapses/expands it without reconnecting. Navigation help has its own bordered pane and wraps when needed. Full-width bars show dbdash/provider/READ ONLY above and mode/database below. + Only badges have colored backgrounds; the remaining bar area uses terminal defaults. Focused inputs show one-based line:column (Unicode characters, not screen cells). The query editor sits above rows/results; the explorer spans both panes. Explorer and rows/schema bottom borders align; relation/page/column status