fix: style top-right access as a matching corner badge
This commit is contained in:
+21
-4
@@ -549,7 +549,7 @@ fn draw_bars(
|
|||||||
let access = access.map_or("NOT CONNECTED", AccessMode::label);
|
let access = access.map_or("NOT CONNECTED", AccessMode::label);
|
||||||
let [brand_area, access_area] = Layout::horizontal([
|
let [brand_area, access_area] = Layout::horizontal([
|
||||||
Constraint::Min(0),
|
Constraint::Min(0),
|
||||||
Constraint::Length(access.len() as u16),
|
Constraint::Length(access.len() as u16 + 4),
|
||||||
])
|
])
|
||||||
.areas(top);
|
.areas(top);
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
@@ -560,7 +560,15 @@ fn draw_bars(
|
|||||||
.style(base),
|
.style(base),
|
||||||
brand_area,
|
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);
|
frame.render_widget(Paragraph::new("").style(base), bottom);
|
||||||
let position = position.map(|(line, column)| format!(" {line}:{column} "));
|
let position = position.map(|(line, column)| format!(" {line}:{column} "));
|
||||||
let position = position.as_deref().unwrap_or(" N/A ");
|
let position = position.as_deref().unwrap_or(" N/A ");
|
||||||
@@ -1616,8 +1624,17 @@ mod tests {
|
|||||||
let header: String = (0..width)
|
let header: String = (0..width)
|
||||||
.map(|x| terminal.backend().buffer()[(x, 0)].symbol())
|
.map(|x| terminal.backend().buffer()[(x, 0)].symbol())
|
||||||
.collect();
|
.collect();
|
||||||
assert!(header.starts_with(" dbdash ▓░"));
|
let status = format!("░▓ {} ", access.map_or("NOT CONNECTED", AccessMode::label));
|
||||||
assert!(header.ends_with(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 ▓░"));
|
||||||
|
}
|
||||||
|
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(())
|
Ok(())
|
||||||
|
|||||||
+1
-1
@@ -82,7 +82,7 @@ Navigation:
|
|||||||
Enter on the connected database collapses/expands it without reconnecting.
|
Enter on the connected database collapses/expands it without reconnecting.
|
||||||
Keybindings float above the workspace; Up/Down/jk scroll, Home/End/g/G jump.
|
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.
|
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,
|
Saved PostgreSQL connections show database · user@host:port beside the mode,
|
||||||
regardless of custom sidebar names; passwords are never included.
|
regardless of custom sidebar names; passwords are never included.
|
||||||
The database provider sits immediately left of the bottom-right position badge.
|
The database provider sits immediately left of the bottom-right position badge.
|
||||||
|
|||||||
Reference in New Issue
Block a user