fix: style top-right access as a matching corner badge

This commit is contained in:
Valdemar Lorenzen
2026-10-20 16:47:34 +02:00
parent 1ed981b43d
commit 77a0ac373f
2 changed files with 22 additions and 5 deletions
+20 -3
View File
@@ -549,7 +549,7 @@ fn draw_bars(
let access = access.map_or("NOT CONNECTED", AccessMode::label);
let [brand_area, access_area] = Layout::horizontal([
Constraint::Min(0),
Constraint::Length(access.len() as u16),
Constraint::Length(access.len() as u16 + 4),
])
.areas(top);
frame.render_widget(
@@ -560,7 +560,15 @@ fn draw_bars(
.style(base),
brand_area,
);
frame.render_widget(Paragraph::new(access).right_aligned().style(base), access_area);
frame.render_widget(
Paragraph::new(Line::from(vec![
Span::styled("░▓", edge),
Span::styled(format!(" {access} "), badge),
]))
.right_aligned()
.style(base),
access_area,
);
frame.render_widget(Paragraph::new("").style(base), bottom);
let position = position.map(|(line, column)| format!(" {line}:{column} "));
let position = position.as_deref().unwrap_or(" N/A ");
@@ -1616,8 +1624,17 @@ mod tests {
let header: String = (0..width)
.map(|x| terminal.backend().buffer()[(x, 0)].symbol())
.collect();
let status = format!("░▓ {} ", access.map_or("NOT CONNECTED", AccessMode::label));
assert!(header.ends_with(&status));
if usize::from(width) >= Line::raw(&status).width() + 10 {
assert!(header.starts_with(" dbdash ▓░"));
assert!(header.ends_with(access.map_or("NOT CONNECTED", AccessMode::label)));
}
let buffer = terminal.backend().buffer();
assert_eq!(buffer[(width - 1, 0)].bg, Color::Cyan);
assert_eq!(buffer[(width - 1, 0)].fg, Color::Black);
let edge_x = width - (access.map_or("NOT CONNECTED", AccessMode::label).len() as u16 + 4);
assert_eq!(buffer[(edge_x, 0)].bg, Color::Reset);
assert_eq!(buffer[(edge_x, 0)].fg, Color::Cyan);
}
}
Ok(())
+1 -1
View File
@@ -82,7 +82,7 @@ Navigation:
Enter on the connected database collapses/expands it without reconnecting.
Keybindings float above the workspace; Up/Down/jk scroll, Home/End/g/G jump.
Query Insert mode and connection/password fields keep ? as literal text.
Full-width bars show dbdash at top-left, live access mode at top-right, and mode/database below.
Full-width bars show matching dbdash (top-left) and live access (top-right) badges, with mode/database below.
Saved PostgreSQL connections show database · user@host:port beside the mode,
regardless of custom sidebar names; passwords are never included.
The database provider sits immediately left of the bottom-right position badge.