feat: show N/A when cursor position is unavailable
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
- [x] capture a safe database display name on successful saved-profile and CLI connections, including SQLite; use the connected database, not explorer selection or `Database::name()` (which returns the provider). Never expose raw connection strings/passwords; show a clear disconnected state and retain the previous identity after a failed switch.
|
- [x] capture a safe database display name on successful saved-profile and CLI connections, including SQLite; use the connected database, not explorer selection or `Database::name()` (which returns the provider). Never expose raw connection strings/passwords; show a clear disconnected state and retain the previous identity after a failed switch.
|
||||||
- [x] add Normal/Insert query editing with mode-aware key routing; define entry/navigation keys and make Esc leave Insert before returning to the explorer. Preserve query execution, multiline editing, paste, and focus cycling.
|
- [x] add Normal/Insert query editing with mode-aware key routing; define entry/navigation keys and make Esc leave Insert before returning to the explorer. Preserve query execution, multiline editing, paste, and focus cycling.
|
||||||
- [x] keep connection/password forms direct-entry for now; make the mode indicator reflect the focused surface rather than a stale query mode.
|
- [x] keep connection/password forms direct-entry for now; make the mode indicator reflect the focused surface rather than a stale query mode.
|
||||||
- [x] expose position from the existing `Input` cursor instead of duplicating state; follow the focused query/form field, hide position outside inputs, and define Unicode column semantics consistently.
|
- [x] expose position from the existing `Input` cursor instead of duplicating state; follow the focused query/form field, show N/A outside inputs, and define Unicode column semantics consistently.
|
||||||
- [x] keep relation/page/column status in pane borders and accommodate the separate help pane; do not add tabs, title templates, custom segments, or editor-specific status.
|
- [x] keep relation/page/column status in pane borders and accommodate the separate help pane; do not add tabs, title templates, custom segments, or editor-specific status.
|
||||||
- [x] handle narrow/short terminals without overlapping content: truncate the database label before mode/position, and let bars yield to content when height is insufficient.
|
- [x] handle narrow/short terminals without overlapping content: truncate the database label before mode/position, and let bars yield to content when height is insufficient.
|
||||||
- [x] verify mode transitions/key precedence, focused-input Unicode positions, connection identity on successful/failed switches, and constrained layouts; smoke-run the TUI and ask for a visual check.
|
- [x] verify mode transitions/key precedence, focused-input Unicode positions, connection identity on successful/failed switches, and constrained layouts; smoke-run the TUI and ask for a visual check.
|
||||||
@@ -19,5 +19,6 @@
|
|||||||
- [x] remove the bottom navigation help panel and have a keybinding overview appear in a floating window when pressing `?` in normal mode
|
- [x] remove the bottom navigation help panel and have a keybinding overview appear in a floating window when pressing `?` in normal mode
|
||||||
- [x] remove the path from the database entry in the sidebar (can be viewed in the info panel)
|
- [x] remove the path from the database entry in the sidebar (can be viewed in the info panel)
|
||||||
- [x] info panel should also pop up when pressing `i` on a child entry of that database entry in the sidebar (instead of only when the parent/database connection is hovered)
|
- [x] info panel should also pop up when pressing `i` on a child entry of that database entry in the sidebar (instead of only when the parent/database connection is hovered)
|
||||||
- [ ] `line:col` indicator in the bottom-right status bar should never disappear but instead display "N/A" in that case.
|
- [x] `line:col` indicator in the bottom-right status bar should never disappear but instead display "N/A" in that case.
|
||||||
- [ ] database type indicator should be moved down just left of the "line:col" indicator like in the attached image
|
- [ ] database type indicator should be moved down just left of the "line:col" indicator like in the attached image
|
||||||
|
- [ ] introduce vim navigation inside the query input field.
|
||||||
+33
-15
@@ -436,11 +436,9 @@ fn draw_bars(
|
|||||||
);
|
);
|
||||||
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 mode_width = bottom.width.min(10);
|
let position = position.as_deref().unwrap_or(" N/A ");
|
||||||
let position_width = position
|
let position_width = (position.len() as u16 + 2).min(bottom.width);
|
||||||
.as_ref()
|
let mode_width = bottom.width.saturating_sub(position_width).min(10);
|
||||||
.map_or(0, |text| text.len() as u16 + 2)
|
|
||||||
.min(bottom.width.saturating_sub(mode_width));
|
|
||||||
let [mode, name_area, cursor] = Layout::horizontal([
|
let [mode, name_area, cursor] = Layout::horizontal([
|
||||||
Constraint::Length(mode_width),
|
Constraint::Length(mode_width),
|
||||||
Constraint::Min(0),
|
Constraint::Min(0),
|
||||||
@@ -456,16 +454,14 @@ fn draw_bars(
|
|||||||
mode,
|
mode,
|
||||||
);
|
);
|
||||||
frame.render_widget(Paragraph::new(format!(" {name}")).style(base), name_area);
|
frame.render_widget(Paragraph::new(format!(" {name}")).style(base), name_area);
|
||||||
if let Some(position) = position {
|
frame.render_widget(
|
||||||
frame.render_widget(
|
Paragraph::new(Line::from(vec![
|
||||||
Paragraph::new(Line::from(vec![
|
Span::styled("░▓", edge),
|
||||||
Span::styled("░▓", edge),
|
Span::styled(position, badge),
|
||||||
Span::styled(position, badge),
|
]))
|
||||||
]))
|
.style(base),
|
||||||
.style(base),
|
cursor,
|
||||||
cursor,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
@@ -1198,6 +1194,28 @@ mod tests {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unavailable_position_keeps_its_badge_even_in_a_narrow_bar() -> Result<()> {
|
||||||
|
let mut terminal = ratatui::Terminal::new(ratatui::backend::TestBackend::new(7, 6))?;
|
||||||
|
terminal.draw(|frame| {
|
||||||
|
let [top, _, bottom] = shell_areas(frame.area());
|
||||||
|
draw_bars(
|
||||||
|
frame,
|
||||||
|
top,
|
||||||
|
bottom,
|
||||||
|
"SQLite",
|
||||||
|
"long database name",
|
||||||
|
false,
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
})?;
|
||||||
|
let footer: String = (0..7)
|
||||||
|
.map(|x| terminal.backend().buffer()[(x, 5)].symbol())
|
||||||
|
.collect();
|
||||||
|
assert_eq!(footer, "░▓ N/A ");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn explorer_keeps_relations_under_the_connected_database() {
|
fn explorer_keeps_relations_under_the_connected_database() {
|
||||||
use ExplorerEntry::{Database as Db, Relation as Rel};
|
use ExplorerEntry::{Database as Db, Relation as Rel};
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ Navigation:
|
|||||||
Full-width bars show dbdash/provider/READ ONLY above and mode/database below.
|
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.
|
Only badges have colored backgrounds; the remaining bar area uses terminal defaults.
|
||||||
Focused inputs show one-based line:column (Unicode characters, not screen cells).
|
Focused inputs show one-based line:column (Unicode characters, not screen cells).
|
||||||
|
The position badge shows N/A outside focused inputs, including in info/help popups.
|
||||||
The query editor sits above rows/results; the explorer spans both panes.
|
The query editor sits above rows/results; the explorer spans both panes.
|
||||||
Explorer and rows/schema bottom borders align; table names appear in the
|
Explorer and rows/schema bottom borders align; table names appear in the
|
||||||
top-right border, with page/column status below. Read errors appear above the query editor.
|
top-right border, with page/column status below. Read errors appear above the query editor.
|
||||||
|
|||||||
Reference in New Issue
Block a user