Skip to content

feat(workspace): data grid cell context menu and non-destructive right-click actions #678

Description

@ZhuchkaTriplesix

Problem Statement

Currently in VirtualResultGrid (lib/features/workspace/result_grid_view.dart:729), right-clicking on any table cell (onCellSecondaryTap) executes:

void _onCellSecondaryTap(int row, int column) {
  _focusNode.requestFocus();
  widget.onRowSelected?.call(row);
  if (_selection != null && _selection!.contains(row, column)) {
    _copySelection();
  } else {
    // ...
    _copySelection();
  }
}

This creates critical UX friction:

  1. Destructive clipboard overwrite: Right-clicking on a cell immediately and silently overwrites the user's OS clipboard with the cell value. If the user had copied a query, password, or URL elsewhere, that clipboard content is wiped without warning.
  2. Missing context menu: Users in professional database clients (DataGrip, DBeaver, TablePlus) expect a context menu offering copy variants, quick filtering, value inspection, and DML operations.

Proposed Architecture & Solution

Implement a native desktop ContextMenu on cell secondary click (using shadcn_flutter's ContextMenu / showContextMenu consistent with connections_panel_sidebar.dart):

1. Copy Actions

  • Copy Value (Ctrl+C / Cmd+C)
  • Copy with Headers
  • Copy as JSON (encodes selected row/cells as JSON object or array)
  • Copy as CSV / TSV

2. Instant Filter Bridge (Filter by Cell)

  • Filter by Value: Appends or sets column = 'value' in DataGridFilterBar.
  • Filter Out Value: Appends column != 'value'.
  • Filter Greater / Less than: For numeric/date columns.

3. Value Inspection & Editing

  • Inspect Cell Value… (Ctrl+I / Cmd+I): Opens showGridCellInspectorDialog for viewing large JSON, XML, or multi-line strings.
  • Set NULL (Alt+N): Explicitly sets cell to NULL in DataGridStagingBuffer.
  • Set to Default / Empty String.
  • Revert Cell Changes: If modified in staging buffer.

4. Row Operations

  • Duplicate Row (seeds a new insert in staging buffer).
  • Delete Row (marks row deleted in staging buffer).

Acceptance Criteria

  • Right-click does NOT silently overwrite the system clipboard.
  • Context menu appears smoothly at the pointer location.
  • Filtering from context menu immediately updates DataGridFilterBar and re-evaluates filtered rows.
  • All keyboard shortcuts (Ctrl+C, Ctrl+I, Alt+N) remain fully functional.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    editorCode/SQL editorenhancementNew feature or requestfrontendTheme parser epic label: frontend

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions