diff --git a/TODO.md b/TODO.md index 721e41e..65c0280 100644 --- a/TODO.md +++ b/TODO.md @@ -1,2 +1,3 @@ - [ ] feature: ability to give the connection configs a custom name (control how they're displayed in the sidebar) +- [ ] feature: ability to remove a database connection - [ ] feature: line numbers in gutter of sql editor \ No newline at end of file diff --git a/src/connection.rs b/src/connection.rs index 7106a23..4b2ebe2 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -20,6 +20,7 @@ use crate::{ pub fn run(terminal: &mut DefaultTerminal, initial: Option) -> Result<()> { let mut profiles = Profiles::open(&config_path()?)?; let mut browser = initial.map(App::new).transpose()?; + let mut connection_label: Option = None; let mut selection = ListState::default().with_selected((!profiles.entries.is_empty()).then_some(0)); let mut focus = Focus::Explorer; @@ -52,7 +53,7 @@ pub fn run(terminal: &mut DefaultTerminal, initial: Option) -> Result< info.is_none() && focus == Focus::Query && browser.as_ref().is_some_and(App::query_insert_mode) }; - let name = browser.as_ref().map_or("Not connected", App::database_name); + let name = connection_label.as_deref().unwrap_or_else(|| browser.as_ref().map_or("Not connected", App::database_name)); draw_bars(frame, top, bottom, browser.as_ref().map_or("—", App::provider), name, insert, position); let [sidebar, content] = Layout::horizontal([Constraint::Length(32), Constraint::Min(1)]) .areas(workspace); @@ -132,6 +133,7 @@ pub fn run(terminal: &mut DefaultTerminal, initial: Option) -> Result< }) .map(|connected| { browser = Some(connected); + connection_label = Some(form.label()); active = selection.selected().and_then(|index| { match entries[index] { @@ -241,6 +243,7 @@ pub fn run(terminal: &mut DefaultTerminal, initial: Option) -> Result< match form.connect().and_then(App::new) { Ok(connected) => { browser = Some(connected); + connection_label = Some(form.label()); active = Some(index); selection.select(Some(index)); expanded = true; diff --git a/src/main.rs b/src/main.rs index f5fa3fc..c244f6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,6 +52,8 @@ Navigation: 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/READ ONLY above and mode/database below. + Saved PostgreSQL connections show database · user@host:port beside the mode, + matching the sidebar; passwords are never included. The database provider sits immediately left of the bottom-right position badge. Only badges have colored backgrounds; the remaining bar area uses terminal defaults. Focused inputs show one-based line:column (Unicode characters, not screen cells).