Skip to content

ADD: CSV/TSV Table Grid Lister Plugin with Inline Find & Replace#37

Open
pplupo wants to merge 15 commits into
doublecmd:masterfrom
pplupo:csvview
Open

ADD: CSV/TSV Table Grid Lister Plugin with Inline Find & Replace#37
pplupo wants to merge 15 commits into
doublecmd:masterfrom
pplupo:csvview

Conversation

@pplupo
Copy link
Copy Markdown
Contributor

@pplupo pplupo commented Jun 3, 2026

This PR updates the CSV plugin for Double Commander built with Qt6 to visualize, navigate, edit, and export CSV and TSV files in an interactive spreadsheet-like grid (QTableWidget). It also includes a fully integrated, focus-safe Find & Replace utility panel.

Key Features

1. Spreadsheet Grid View & Visuals

  • Grid Rendering: Visualizes files in a spreadsheet layout. Supports optional grid lines and auto-resizing column widths to fit content.
  • Header Row Toggle: Treat the first row of a file as column headers (with sorting capability) or as a regular data row.
  • Text / Source View Mode: Toggle to a raw, unparsed text view of the file with optional word wrap.
  • External Application Integration: Launch the default external system spreadsheet editor directly from the toolbar.

2. Auto-Detection & RFC Parsing

  • Encoding Engine: Auto-detects Cyrillic, UTF-8, Latin, etc. via Enca 1.19 (compiled and statically linked to the plugin library).
  • Double-Quote Parsing: Handles double-quoted fields containing separators (commas/tabs) or newlines, adhering to RFC standard specifications.

3. Edit & Undo/Redo Stack

  • Inline Editing: Double-click any cell to modify its content.
  • Row & Column Operations: Insert empty columns/rows, delete selections, or paste content directly from the clipboard.
  • Interactive Column Reordering: Horizontal drag-and-drop column headers to rearrange columns.
  • Full History: All cell edits, column rearrangements, row/column additions, row/column deletions, and sorting actions are fully managed via a QUndoStack for complete Undo (Ctrl+Z) and Redo (Ctrl+shift+ZorCtrl+Y`) capability.
  • Dirty Indicator: Toolbar indicator ( / *) showing unsaved history changes.

4. Inline Find & Replace Panel

Press Ctrl+F, Ctrl+R, or click the toolbar 🔍 Find/Replace button in the grid view to open a collapsible search panel at the bottom of the layout:

  • Interactive Scope Limits: Confines searches and replacements to All Cells, Selected Cells, Current Column, or Current Row.
  • Flexible Querying: Supports Case Sensitivity, exact cell matching (Match Entire Cell), and Regular Expression (QRegularExpression) patterns.
  • Atomic Replace All: Bundles all replacements in a single transaction under a QUndoStack macro so that they can be undone/redone in a single action.
  • Auto-Quoting Protection: If editing or replacing inserts a separator character (e.g. a comma into a CSV), the plugin automatically sets the cell metadata to wrap the value in double quotes and escape internal quotes on text preview or file save. This metadata change is fully reverted if the edit is undone.

5. Focus & DC Pane Coordination

  • Focus Safety: Implemented click-outside event filtering and synchronous deactivation. When focus moves outside the lister, the plugin safely yields focus to the main container, preventing trapped key events and enabling smooth file list navigation and pane switching in Double Commander.
  • Panel Key Bypass: Prevents Double Commander from trapping navigation and delete keys when typing inside the Find/Replace panel text inputs.

🛠 Build & Installation

  • The plugin compiles under Qt6 using standard makefiles.
  • Configured in build.sh to compile and package csvview_qt6.wlx along with translation files into the release archive under release/wlx/csvview/.
  • Configuration options (Enca language hints, double-quoting handling, grid painting, etc.) are managed in j2969719.ini.

pplupo added 15 commits May 13, 2026 10:11
…ete row editing, TSV support, and context menu

- Display CSV/TSV files in an interactive QTableWidget grid
- Auto-detect separator (comma, semicolon, tab); fall back to file extension
- Header Row toggle button: interprets first line as header or data row,
  reloads file on toggle; controls whether copies include the header line
- Ctrl+C: copy selection as TSV (includes header when Header Row is on)
- Right-click context menu: Copy as TSV, Copy as CSV, Delete Selected Rows,
  Insert from Clipboard
- Ctrl+V: insert clipboard rows at selected position; validates column count;
  skips clipboard header line when it matches the current header (Header Row on)
- Delete: remove selected rows
- Ctrl+S: save file; correctly handles editing vs non-editing state without
  disturbing Double Commander focus
- Inline cell editing with Save / Save As / Reload toolbar actions
- Enca encoding auto-detection with Glib conversion fallback
- Double-quoted field parsing per CSV RFC
- F7 search support
- Full README with screenshots, feature docs, and configuration reference
- Attribution to original author j2969719
This makes the plugin standalone by compiling and linking libenca statically, removing the need for users to manually install libenca.so.0.
Adds ability to insert empty rows or clipboard rows above/below current selection or clicked row.
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.

1 participant