feat: position results context on top-right border

This commit is contained in:
Valdemar Lorenzen
2026-10-19 15:41:02 +02:00
parent 59796d9ab0
commit c75c6654f1
3 changed files with 23 additions and 10 deletions
+6 -2
View File
@@ -15,5 +15,9 @@
- [x] remove this top-most line above the panels on the right-hand side: `dbdash │ SQLite │ READ ONLY`. - [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] 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. - [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 - [x] 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 - [ ] remove the bottom navigation help panel and have a keybinding overview appear in a floating window when pressing `?` in normal mode
- [ ] remove the path from the database entry in the sidebar (can be viewed in the info panel)
- [ ] 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.
- [ ] database type indicator should be moved down just left of the "line:col" indicator like in the attached image
+15 -6
View File
@@ -360,8 +360,7 @@ impl App {
let relation = &self.relations[index]; let relation = &self.relations[index];
if self.show_schema { if self.show_schema {
format!( format!(
" {} [{}] · {} columns · fields {}–{}/5", " [{}] · {} columns · fields {}–{}/5",
relation.label,
relation.kind, relation.kind,
self.columns.len(), self.columns.len(),
self.column_offset + 1, self.column_offset + 1,
@@ -375,8 +374,7 @@ impl App {
}; };
let end = self.page_index * PAGE_SIZE + self.page.rows.len(); let end = self.page_index * PAGE_SIZE + self.page.rows.len();
format!( format!(
" {} [{}] · rows {start}–{end} · page {}{} · columns {}–{}/{}", " [{}] · rows {start}–{end} · page {}{} · columns {}–{}/{}",
relation.label,
relation.kind, relation.kind,
self.page_index + 1, self.page_index + 1,
if self.page.has_next { " (more)" } else { "" }, if self.page.has_next { " (more)" } else { "" },
@@ -388,8 +386,15 @@ impl App {
} else { } else {
" No readable relations. r to refresh.".into() " No readable relations. r to refresh.".into()
}; };
let content_block = let mut content_block =
panel(title, focus == Focus::Rows).title_bottom(Line::from(description).left_aligned()); panel(title, focus == Focus::Rows).title_bottom(Line::from(description).left_aligned());
if self.query_result.is_none()
&& let Some(index) = self.active
{
content_block = content_block.title_top(
Line::from(format!(" {} ", self.relations[index].label)).right_aligned(),
);
}
let page = self let page = self
.query_result .query_result
.as_ref() .as_ref()
@@ -720,8 +725,12 @@ mod tests {
terminal.draw(|frame| app.draw(frame, frame.area(), super::Focus::Rows))?; terminal.draw(|frame| app.draw(frame, frame.area(), super::Focus::Rows))?;
let buffer = terminal.backend().buffer(); let buffer = terminal.backend().buffer();
let border: String = (0..100).map(|x| buffer[(x, 19)].symbol()).collect(); let border: String = (0..100).map(|x| buffer[(x, 19)].symbol()).collect();
assert!(border.starts_with("└ main.comments [table]"), "{border}");
assert!(border.ends_with('┘'), "{border}"); assert!(border.ends_with('┘'), "{border}");
assert!(!border.contains("main.comments"));
assert!((0..19).any(|y| {
let line: String = (0..100).map(|x| buffer[(x, y)].symbol()).collect();
line.ends_with(" main.comments ┐")
}));
assert!(border.contains(if schema { assert!(border.contains(if schema {
"fields 1–4/5" "fields 1–4/5"
} else { } else {
+2 -2
View File
@@ -46,8 +46,8 @@ Navigation:
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 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; relation/page/column status Explorer and rows/schema bottom borders align; table names appear in the
appears in the rows/schema border. Read errors appear above the query editor. top-right border, with page/column status below. Read errors appear above the query editor.
Query editor starts in NORMAL: i/a/I/A enters INSERT; hjkl/arrows move. Query editor starts in NORMAL: i/a/I/A enters INSERT; hjkl/arrows move.
In INSERT, type SQL; Enter inserts a newline. Arrow keys, Home/End, In INSERT, type SQL; Enter inserts a newline. Arrow keys, Home/End,
Backspace/Delete, Ctrl-U (clear), and multiline pasting are supported. Backspace/Delete, Ctrl-U (clear), and multiline pasting are supported.