diff --git a/src/ui/app.rs b/src/ui/app.rs index cec50b6..f232f6d 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -493,6 +493,34 @@ impl App { self.focus = Focus::Editor; return Ok(()); } + // Alt+1/2/3: Jump directly to Sidebar/Editor/Results + (KeyCode::Char('1'), m) if m.contains(KeyModifiers::ALT) => { + if !matches!( + self.focus, + Focus::ConnectionDialog | Focus::Help | Focus::ExportPicker + ) { + self.focus = Focus::Sidebar; + return Ok(()); + } + } + (KeyCode::Char('2'), m) if m.contains(KeyModifiers::ALT) => { + if !matches!( + self.focus, + Focus::ConnectionDialog | Focus::Help | Focus::ExportPicker + ) { + self.focus = Focus::Editor; + return Ok(()); + } + } + (KeyCode::Char('3'), m) if m.contains(KeyModifiers::ALT) => { + if !matches!( + self.focus, + Focus::ConnectionDialog | Focus::Help | Focus::ExportPicker + ) { + self.focus = Focus::Results; + return Ok(()); + } + } _ => {} } @@ -1813,6 +1841,27 @@ impl App { fn copy_selected_cell(&mut self) { if let Some(result) = self.results.get(self.current_result) { + // If the current result has an error, copy the error message + if let Some(error) = &result.error { + let mut text = format!("{}: {}", error.category, error.message); + if let Some(detail) = &error.detail { + text.push_str(&format!("\nDetail: {}", detail)); + } + if let Some(hint) = &error.hint { + text.push_str(&format!("\nHint: {}", hint)); + } + if let (Some(line), Some(col)) = (error.line, error.col) { + text.push_str(&format!("\nAt line {}, column {}", line, col)); + } + if let Ok(mut clipboard) = arboard::Clipboard::new() { + let _ = clipboard.set_text(&text); + self.set_status( + "Error message copied to clipboard".to_string(), + StatusType::Info, + ); + } + return; + } if let Some(row) = result.rows.get(self.result_selected_row) { if let Some(cell) = row.get(self.result_selected_col) { let text = cell.display(); diff --git a/src/ui/components.rs b/src/ui/components.rs index 88c3fe0..e2001d3 100644 --- a/src/ui/components.rs +++ b/src/ui/components.rs @@ -1619,6 +1619,7 @@ fn draw_help_overlay(frame: &mut Frame, app: &App) { " NAVIGATION", " Tab Next pane", " Shift+Tab Previous pane", + " Alt+1/2/3 Jump to Sidebar/Editor/Results", " (Sidebar → Editor → Results → ...)", "", " EDITOR", @@ -1643,7 +1644,7 @@ fn draw_help_overlay(frame: &mut Frame, app: &App) { " Tab/Shift+Tab Next/Prev column", " Arrow keys Navigate cells", " Esc Back to editor", - " Ctrl+C Copy cell value", + " Ctrl+C Copy cell value / error msg", " Ctrl+E Toggle EXPLAIN plan view", " Ctrl+S Export results", " Ctrl+[/] Prev/Next result set",