- PreferencesDialog (Tools → Preferences, Ctrl+,): font family/size,
word wrap, default page size, query timeout, max history, auto-commit;
font changes apply live to all open editors via apply_settings() cascade
- CodeEditor and TableViewer now read initial values from settings singleton
- SQL formatter (≡ Format button): uses sqlparse to reindent and uppercase
keywords; gracefully prompts to install sqlparse if missing
- Table viewer context menu: "Filter by this value" (populates WHERE and
reloads), "Copy row as SQL INSERT" (ready-to-paste INSERT statements),
renamed "Copy row" → "Copy row as TSV" for clarity
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ShortcutsDialog: grouped tree of all keyboard shortcuts (Help menu)
- Workspace tab context menu: Rename, Close, Close Others, Close to Right
- SQL query tab context menu: Rename, Duplicate, Close, Close Others
- Smart status bar: right-side connection indicator + selected cell preview
- File → Open SQL File (Ctrl+O), Save (Ctrl+S), Save As, Open Recent
- Recent files persisted to ~/.dbclient/recent_files.json (last 10)
- TableViewer.cell_selected signal wired to status bar cell preview
- EditorTab._filepath tracks the file associated with each query tab
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add SqlCompleter (sql_completer.py): schema-aware popup with keyword,
table, view, and lazy column completions; dot-notation and Ctrl+Space
- Add FindBar to EditorTab: inline find/replace with wrap-around,
case/whole-word flags, match count, and Ctrl+F / Ctrl+H shortcuts
- Color workspace tab text by connection profile in MainWindow
- Move Toggle History shortcut Ctrl+H → Ctrl+Shift+H to free Ctrl+H
for Find & Replace
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New file app/ui/sql_completer.py:
- SqlCompleter (QObject) owns a _CompletionPopup (QListWidget) that
floats above the editor as a ToolTip-style frameless window styled
to match the Catppuccin Mocha theme.
- SQL keyword pool sourced directly from syntax_highlighter._KEYWORDS,
_TYPES, _FUNCTIONS so the two features stay in sync.
- Schema data (tables, views, columns) loaded asynchronously via
SchemaWorker; a generation counter discards stale results when the
database changes rapidly.
- Column loading is lazy: fires only when the user types "table."
(dot-qualified prefix), avoiding upfront cost for wide schemas.
- _extract_prefix() uses a regex to detect both bare words and
"table.col" dot notation; guards against completing inside string
literals by counting unescaped quotes to the left of the cursor.
- _accept_completion() replaces only the typed prefix, preserving any
qualifier already in the document (e.g. "orders.cu" → "orders.customer_id").
Changes to app/ui/sql_editor.py:
- CodeEditor.set_completer() attaches the completer and stores it.
- keyPressEvent priority order:
1. Popup visible → Esc hides, Enter/Tab accepts, Up/Down navigates.
2. Ctrl+Space → force-show completions (1-char minimum).
3. Tab (no popup) → existing 4-space insert behaviour preserved.
4. Ctrl+/ → existing comment-toggle preserved.
5. All other keys → super() then auto-trigger (2-char minimum).
- focusOutEvent hides the popup when the editor loses focus.
- EditorTab._build_ui() creates SqlCompleter, attaches it, and calls
set_context() if a driver is already present.
- EditorTab.set_context() updates driver/database and reloads schema.
- _maybe_invalidate_schema() re-fetches schema after CREATE/DROP/ALTER
so newly created tables appear in completions immediately.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>