Skip to content

[WIP] Improve system keyboard shortcut functionality#2

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/improve-keyboard-shortcut
Closed

[WIP] Improve system keyboard shortcut functionality#2
Copilot wants to merge 1 commit intomainfrom
copilot/improve-keyboard-shortcut

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 22, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Improve system keyboard shortcut, ...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI requested a review from datlechin December 22, 2025 15:20
@datlechin datlechin closed this Dec 23, 2025
@datlechin datlechin deleted the copilot/improve-keyboard-shortcut branch February 6, 2026 10:43
datlechin added a commit that referenced this pull request Apr 28, 2026
Implement the new Connection trait methods on each driver so the
Structure tab can load existing indexes and FK constraints when
opening a table for editing.

- Postgres: pg_index + pg_constraint joined with pg_class /
  pg_attribute. array_agg(... ORDER BY ordinality) preserves the
  column order on composite indexes / FKs. confdeltype /
  confupdtype single-char codes map through pg_action_char_to_keyword
  to canonical SQL action keywords ("RESTRICT", "CASCADE", etc.).
- MySQL: information_schema.statistics for indexes (grouped by
  index_name in Rust since sqlx doesn't aggregate ordered column
  arrays natively); key_column_usage JOIN referential_constraints
  for FKs. "PRIMARY" maps to is_primary; non_unique inverts to unique.
- SQLite: PRAGMA index_list + per-index PRAGMA index_info. Implicit
  PK indexes that use the rowid alias don't appear in index_list
  so they're synthesised from PRAGMA table_info when no origin='pk'
  row exists. PRAGMA foreign_key_list grouped by synthetic id since
  SQLite doesn't store user-visible FK names — we render
  "fk_{table}_{id}" stably.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
datlechin added a commit that referenced this pull request Apr 28, 2026
Two bugs surfaced from a screenshot of the Edit-mode Structure tab
on a freshly-loaded MySQL "users" table:

1. Double title bar — the embedded adw::HeaderBar inside structure_tab
   inherited GTK4's default show_start_title_buttons / show_end_title
   _buttons = true and rendered its own min / max / close trio under
   the AdwApplicationWindow's real chrome. Fix: explicit
   .show_start_title_buttons(false).show_end_title_buttons(false) on
   the embedded header.

2. "19 pending changes" before any user input. Cause: GTK fires
   `changed` and `toggled` synchronously during widget set-up — when
   rebuild_columns_view tears down + recreates the row widgets, every
   Entry::set_text / CheckButton::set_active for the loaded values
   echoes back through the row's connect_* handlers, which treat them
   as fresh user edits and stamp AlterColumn ops onto the tracker.
   For 7 columns × ~3 fields each that's exactly the 19 phantom ops
   the user saw.

   Fix is two-pronged:
   - rebuild_columns_view sets the existing suppress_emit flag to
     true before the rebuild, schedules glib::idle_add_local_once to
     reset it once the initial signal storm drains. Every signal
     handler in build_column_row now checks suppress_emit and
     returns early when it's true, so widget set-up stays silent.
   - ColumnEdited handler now skips the tracker push entirely when
     the post-edit DraftColumn matches the prev value (no actual
     change). When the user reverts an existing column to its
     original ColumnInfo, retain_ops strips any prior AlterColumn
     ops on that column so the dirty-count goes back to zero.
     Defence-in-depth — even if a suppress-flag race ever leaks an
     event, a no-op edit can no longer pollute the tracker.

The third reported anomaly (id PK column showing Nullable=✓) was a
downstream consequence of bug #2: a phantom Nullable(true) op fired
during rebuild flipped the model's nullable=true for the id row.
With #2 fixed, the checkbox now reflects MySQL's actual NOT NULL
state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants