diff --git a/TODO.md b/TODO.md index bc43590..c4a716e 100644 --- a/TODO.md +++ b/TODO.md @@ -15,5 +15,9 @@ - [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. -- [ ] 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 +- [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 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 \ No newline at end of file diff --git a/src/app.rs b/src/app.rs index 28a1084..4261840 100644 --- a/src/app.rs +++ b/src/app.rs @@ -360,8 +360,7 @@ impl App { let relation = &self.relations[index]; if self.show_schema { format!( - " {} [{}] · {} columns · fields {}–{}/5", - relation.label, + " [{}] · {} columns · fields {}–{}/5", relation.kind, self.columns.len(), self.column_offset + 1, @@ -375,8 +374,7 @@ impl App { }; let end = self.page_index * PAGE_SIZE + self.page.rows.len(); format!( - " {} [{}] · rows {start}–{end} · page {}{} · columns {}–{}/{}", - relation.label, + " [{}] · rows {start}–{end} · page {}{} · columns {}–{}/{}", relation.kind, self.page_index + 1, if self.page.has_next { " (more)" } else { "" }, @@ -388,8 +386,15 @@ impl App { } else { " 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()); + 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 .query_result .as_ref() @@ -720,8 +725,12 @@ mod tests { terminal.draw(|frame| app.draw(frame, frame.area(), super::Focus::Rows))?; let buffer = terminal.backend().buffer(); 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.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 { "fields 1–4/5" } else { diff --git a/src/main.rs b/src/main.rs index 36100fa..b8ed84a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,8 +46,8 @@ Navigation: 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 - appears in the rows/schema border. Read errors appear above the query editor. + 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. 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, Backspace/Delete, Ctrl-U (clear), and multiline pasting are supported.