Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
b6005c7
feat: Add scaffolding with dummy pane content
HalavicH Dec 6, 2025
cefeb90
feat: Vibe code ascii implementation
HalavicH Dec 6, 2025
1fea39b
feat: Init CSV preview
HalavicH Dec 6, 2025
71288b3
feat: Add counter to POC interactivity
HalavicH Dec 6, 2025
adb75f7
feat: Switch to proper table rendering
HalavicH Dec 6, 2025
a9e29b3
feat: Add runtime change of column width
HalavicH Dec 6, 2025
d35ca6b
feat: Snatch column resizing implementation from "Keymap Editor"
HalavicH Dec 6, 2025
f228048
feat: Update tab name
HalavicH Dec 6, 2025
bdde7ef
feat: Add live-reload for CSV preview
HalavicH Dec 6, 2025
728b743
refactor: Extract parser and renderer modules
HalavicH Dec 6, 2025
10f2a81
[sort] feat: Add POC ordering for 0th column
HalavicH Dec 7, 2025
36638f4
[linenums] feat: Add POC line numbers
HalavicH Dec 7, 2025
bd34cc8
[sort] feat: Add ordering for all columns
HalavicH Dec 7, 2025
0022c46
[selection] feat: Add experimental drag to select
HalavicH Dec 7, 2025
b36e1cb
[linenums] feat: Add dynamic but fixed width for line numbers
HalavicH Dec 7, 2025
3dbb0f0
[selection] fix: Update selection to handle sorted data correctly
HalavicH Dec 7, 2025
b219479
[selection] refactor: Move to separate module
HalavicH Dec 7, 2025
5d46022
[general] refactoring: Rename types/modules
HalavicH Dec 7, 2025
cb4933a
[parser] fix: Support multiline CSV lines
HalavicH Dec 7, 2025
6037383
[linenums] fix: Reflect actual line numbers for multi-line rows
HalavicH Dec 8, 2025
4504fcd
chore: Add licence symlink
HalavicH Dec 8, 2025
efd1b72
fix: Fix typos
HalavicH Dec 8, 2025
d018ceb
fix: Add parsing time logging
HalavicH Dec 8, 2025
586ab7f
[render] feat: Implement variable list rendering mode
HalavicH Dec 11, 2025
ff609af
[render] feat: Add settings panel and support both rendering modes
HalavicH Dec 11, 2025
6fc776f
[render] feat: Add vertical alignment setting
HalavicH Dec 11, 2025
9467aeb
[refactor] Streamline row rendering
HalavicH Dec 11, 2025
e19c8f4
[refactor] Simplify cell rendering
HalavicH Dec 12, 2025
cec6268
[monospace] feat: Add font toggle
HalavicH Dec 12, 2025
43c3c89
[render] refactor: Restructure & streamline
HalavicH Dec 12, 2025
ba0b8c9
[numbering] Update lines displaying
HalavicH Dec 12, 2025
c6418c2
[numbering] Add support for row/line numbering with switching
HalavicH Dec 12, 2025
36d5263
refactor: Extract settings & row identifiers
HalavicH Dec 12, 2025
0cf91c4
refactor: Restructure table related code
HalavicH Dec 12, 2025
cd32b28
refactor: Introduce Data and Display cell types
HalavicH Dec 12, 2025
43c52c5
refactor: Introduce cell newtypes
HalavicH Dec 12, 2025
f6e60f8
refactor: Simplify selection callbacks
HalavicH Dec 12, 2025
cebcc24
refactor: Restructure table related code
HalavicH Dec 12, 2025
daa263b
refactor: Restructure table related code
HalavicH Dec 12, 2025
a057c69
[numbering] Align row identifiers by right side
HalavicH Dec 12, 2025
61dbcff
[selection] feat: Implement copy selected command
HalavicH Dec 12, 2025
55eeadf
[copy] feat: Add copy selected binding
HalavicH Dec 12, 2025
59ed22e
[copy] feat: Add copy as CSV/TSV/Semicolon
HalavicH Dec 12, 2025
a500aeb
[copy] feat: Add copy as Markdown table
HalavicH Dec 12, 2025
189804d
[copy] feat: Add toast on copy
HalavicH Dec 12, 2025
74c3f66
refactor: Extract selection and types to separate modules
HalavicH Dec 12, 2025
a9c23ed
[selection] feat: Add selection clearing
HalavicH Dec 12, 2025
3dc1306
[parsing] fix: Fix tests
HalavicH Dec 12, 2025
d30dab0
[navigation] feat: Add keyboard navigation
HalavicH Dec 12, 2025
b5d5902
refactor: Cache display-to-data indices
HalavicH Dec 12, 2025
09d82e0
[navigation] feat: Implement selection by arrows
HalavicH Dec 12, 2025
da19cfb
[focus] fix: Make CSV preview focused on creation
HalavicH Dec 12, 2025
3723c05
[selection] fix: Upate focused cell with the dragged selection
HalavicH Dec 12, 2025
94a6df1
[selection] feat: Add range selection using keyboard
HalavicH Dec 12, 2025
59617d9
[selection] feat: Add select all command
HalavicH Dec 12, 2025
07759b8
[selection] feat: Color focus and anchor with custom borders
HalavicH Dec 12, 2025
49f0138
[selection] feat: Blend `FOCUS_ANCHOR` color at compile time
HalavicH Dec 12, 2025
0ece629
[selection] feat: Add jump/select to edge commands
HalavicH Dec 12, 2025
ee0f62f
[numbering] feat: Highlight focused row identifier
HalavicH Dec 13, 2025
216596b
[selection] feat: Add cumulative selection using cmd/ctrl
HalavicH Dec 13, 2025
d1a33b3
[copy] fix: Add support for non-rectangle selections
HalavicH Dec 13, 2025
4ef5be6
[copy] feat: Update copy toast to notify about empty cells introduced
HalavicH Dec 13, 2025
092b2a2
[selection] feat: Update anchor and focus to have custom bg
HalavicH Dec 13, 2025
4a3ff5e
[selection] refactor: Newtype selection_start_display
HalavicH Dec 13, 2025
9c7cbdf
[selection] refactor: Switch to display cell for focus and anchor
HalavicH Dec 13, 2025
5a84ad3
[selection] refactor: Remove unused params/fields
HalavicH Dec 13, 2025
34d33fa
[selection] refactor: Remove `selection_start_display` in favor of `s…
HalavicH Dec 13, 2025
1a15f92
docs: Commit progress file
HalavicH Dec 14, 2025
c90dc89
[copy] refactor: Start extracting selected data formatting
HalavicH Dec 14, 2025
d9a4b33
[copy] refactor: Extract notification-related logic
HalavicH Dec 14, 2025
9c9d450
refactor: Switch to using newtype column
HalavicH Dec 14, 2025
d04b17a
refactor: Update copy selected logic with newtypes
HalavicH Dec 14, 2025
e3efb6d
[dev] feat: Add performance metrics overlay
HalavicH Dec 14, 2025
1d4e1f9
fix: Stop cloning `OrderedIndices` on every mouse event :D
HalavicH Dec 14, 2025
33d6c5c
[selection] refactor: Move selection related action handlers to separ…
HalavicH Dec 14, 2025
fc38ad6
[selection] refactor: Streamline selection operations
HalavicH Dec 14, 2025
5b23c42
[selection] refactor: Update action names closer to real behavior
HalavicH Dec 14, 2025
fddd001
[dev] feat: Add selection timings to performance overlay
HalavicH Dec 14, 2025
53417db
[dev] feat: Add render preparation timings to performance overlay
HalavicH Dec 14, 2025
eb4026d
[dev] refactor: Simplify performance overlay rendering
HalavicH Dec 14, 2025
ce1181f
[selection] fix: Stop selection extension if drag stopped outside of …
HalavicH Dec 14, 2025
10368d2
[dev] feat: Measure timings of mouse selections
HalavicH Dec 14, 2025
75b272b
docs: Update progress
HalavicH Dec 14, 2025
3771bcd
[dev] feat: Add capturing rendered indices
HalavicH Dec 14, 2025
463c7d7
[PR] refactor: Clarify naming of variable row height list
HalavicH Dec 15, 2025
a5510cd
docs: Update progress
HalavicH Dec 16, 2025
aa85c67
chore: Copy data table to csv preview crate to reduce compilation time
HalavicH Dec 21, 2025
0432c9b
test: Commit test fixtures
HalavicH Dec 21, 2025
99d3ea2
fix: Preserve list state between renders
HalavicH Dec 21, 2025
57bf3b4
feat: Remove ascii table rendering
HalavicH Dec 21, 2025
c8c9145
feat: Transition to span based parsing
HalavicH Dec 20, 2025
59f7347
feat: Add displaying of cell positions
HalavicH Dec 21, 2025
9532484
feat: Add edit line of focused cell
HalavicH Dec 21, 2025
c0eefa0
feat: Update cell editor text to follow focused cell
HalavicH Dec 21, 2025
825b629
feat: Show focused cell span
HalavicH Dec 21, 2025
8a05e38
feat: Commit cell editor changes on `menu::Confirm`
HalavicH Dec 21, 2025
7a89ad8
feat: Work on escaped inline editing
HalavicH Dec 21, 2025
15ec58b
fix: Update span data to include quotes in offsets
HalavicH Dec 21, 2025
b44fcde
feat: Add smart debounce mechanism
HalavicH Dec 21, 2025
f562c4b
docs: Update progress
HalavicH Dec 21, 2025
f14c091
feat: Rewrite selection mechanism to have optimized select all
HalavicH Dec 21, 2025
22cffbf
feat: Add display/file copy order
HalavicH Dec 21, 2025
84e67dd
feat: Implement focused cell following
HalavicH Dec 21, 2025
bdd469d
feat: Improve notification of edited cell
HalavicH Dec 22, 2025
e376084
feat: Implement cell content in tooltip
HalavicH Dec 22, 2025
2234135
feat: Scrollable abomination
HalavicH Dec 22, 2025
a79dee1
feat: Add option to show/hide perf metrics
HalavicH Dec 22, 2025
b3d62d6
refactor: Move ordering-related code to separate module
HalavicH Dec 22, 2025
1157396
refactor: Rename file
HalavicH Dec 22, 2025
85f194f
refactor: Rename ordering to sorting
HalavicH Dec 22, 2025
2b487ec
feat: Update cell editor
HalavicH Dec 22, 2025
554043d
feat: Extract CellEditor as separate component in order to have separ…
HalavicH Dec 22, 2025
87df38c
feat: Add inline editing
HalavicH Dec 22, 2025
bd50751
feat: Move cell editor line behind checkbox
HalavicH Dec 22, 2025
42f82e4
feat: Hide experimental settings into popover
HalavicH Dec 22, 2025
984cd66
fix: Increase inline cell editor max height
HalavicH Dec 22, 2025
27c959e
fix: Address clippy lints
HalavicH Dec 22, 2025
29ebd1a
docs: Update progress
HalavicH Dec 22, 2025
943b2d2
feat: Add base cell style disabling to data table
HalavicH Dec 23, 2025
7d38078
feat: Update cell rendering to disable overflow in editor mode
HalavicH Dec 23, 2025
a30c583
refactor: Update imports
HalavicH Dec 23, 2025
d182d19
feat: Update table cells with borders and paddings
HalavicH Dec 23, 2025
ae4a79c
refactor: Stremline cell editor
HalavicH Dec 23, 2025
add1a0c
docs: Update progress
HalavicH Dec 23, 2025
68820b7
feat: Add horizontal layout for src line number ranges
HalavicH Dec 23, 2025
fa3fa91
misc: Add 15 columns fixture
HalavicH Dec 23, 2025
eaf41a2
feat: Unify cell background
HalavicH Dec 23, 2025
fb2a719
feat: Add cell borders
HalavicH Dec 23, 2025
fdf1ef5
docs: Update progress
HalavicH Dec 23, 2025
a0b1dea
refactor: Improve type safety
HalavicH Dec 24, 2025
1369f08
refactor: Extract coordinate types to submodule
HalavicH Dec 24, 2025
75c2aca
feat: Introduce TableRow newtype
HalavicH Dec 24, 2025
8009a79
feat: Rewrite table like content to use TableRow
HalavicH Dec 24, 2025
f37f4ec
tmp: Comment broken tests
HalavicH Dec 24, 2025
038c2e2
refactor: Update sorting
HalavicH Dec 24, 2025
553bba6
fix: Re-enable global overflow-hidden for cell
HalavicH Dec 24, 2025
13ea895
refactor: Streamline table row render
HalavicH Dec 24, 2025
ea0be44
feat: Update cell dbg info
HalavicH Dec 24, 2025
8a63de9
refactor: Promote TableCell to enum
HalavicH Dec 24, 2025
74a3976
refactor: Streamile newtype useages
HalavicH Dec 24, 2025
575ff22
[v-cel editing] feat: Implement virtual cell editing support
HalavicH Dec 24, 2025
383bbe5
feat: Start implementing table data engine
HalavicH Dec 25, 2025
2ae7e19
refactor: Move sorting module
HalavicH Dec 25, 2025
f85c7bc
refactor: Move sorting to engine. Update naming
HalavicH Dec 25, 2025
a847b82
refactor: Move content to engine
HalavicH Dec 25, 2025
c5c7602
refactor: Move selection to engine
HalavicH Dec 25, 2025
ff2ec5c
refactor: Move selection logic to engine
HalavicH Dec 25, 2025
9045b69
refactor: Move copy logic to engine
HalavicH Dec 25, 2025
6b7ba4d
refactor: Split selection into engine and view part
HalavicH Dec 25, 2025
3a00255
refactor: Split sorting into engine and view part
HalavicH Dec 25, 2025
b2da20a
refactor: Extract table cell type
HalavicH Dec 25, 2025
11f9b4b
refactor: Move selection handlers
HalavicH Dec 25, 2025
da38fd1
refactor: Move copy handlers
HalavicH Dec 25, 2025
24b4a23
[data_table] refactor: Move data table
HalavicH Dec 25, 2025
b975cb9
refactor: Move render-related code to submodule
HalavicH Dec 25, 2025
81353c9
refactor: Split performance metrics overlay
HalavicH Dec 25, 2025
821dd5a
refactor: Split settings
HalavicH Dec 25, 2025
6df4c0b
refactor: Split table like content
HalavicH Dec 25, 2025
8949b64
refactor: Split cell editor
HalavicH Dec 25, 2025
668e686
feat: Prepare for filtering implementation
HalavicH Dec 25, 2025
d2d6a7c
refactor: Extract table header rendering
HalavicH Dec 25, 2025
5c946bf
feat: Implement POC of filtering
HalavicH Dec 25, 2025
e981372
feat: Generalize performance metrics
HalavicH Dec 25, 2025
622205d
refactor: Stop re-filtering on sorting change
HalavicH Dec 25, 2025
2b52603
feat: Fix and simplify filter implementation
HalavicH Dec 25, 2025
950b3bb
feat: Add clear all button
HalavicH Dec 26, 2025
95a8ee9
Update progress
HalavicH Dec 26, 2025
2f64f1e
Update fixtures
HalavicH Dec 26, 2025
f4a7a84
fix: Update after rebase
HalavicH Dec 27, 2025
3c0eaf3
refactor: Rework d2d mapping system
HalavicH Dec 27, 2025
1d72e6d
feat: Implement filter availability marking
HalavicH Dec 27, 2025
17a8cf5
feat: Add support for filtering by null
HalavicH Dec 27, 2025
ff25de8
fix: Update sorting & filtering merging
HalavicH Dec 27, 2025
587f2f1
feat: Sort filter options by availability and num of occurances
HalavicH Dec 28, 2025
f7e30bc
feat: Change icon of filter button & update progress
HalavicH Dec 28, 2025
41e27b2
[data_table] feat: Extend TableRow implementation
HalavicH Dec 28, 2025
b624ec5
[data_table] feat: Remove const generics from data_table
HalavicH Dec 28, 2025
b8ad04a
feat: Move CSV preview renderer to use dynamic table
HalavicH Dec 28, 2025
0a7f444
fix: Move cols definition to update table width
HalavicH Dec 28, 2025
4f25daa
fixtures: Update demo CSV preview statuses
HalavicH Dec 28, 2025
c826bae
refactor: Remove nasty code duplication
HalavicH Jan 3, 2026
7b37a4d
[data_table] refactor: Internalize TableRow checking
HalavicH Jan 4, 2026
a4307f1
refactor: Update table rendering
HalavicH Jan 4, 2026
8c5c85d
fix: Update unit tests
HalavicH Jan 4, 2026
5d06182
dt: Rename table widths
HalavicH Jan 4, 2026
c46615c
[data_table] Implement table width modes
HalavicH Jan 4, 2026
87d3660
[data_table] poc of column defined table width
HalavicH Jan 6, 2026
015fe74
POC: Add switch between resize modes
HalavicH Jan 6, 2026
2257808
feat: Add switch for column resize mode
HalavicH Jan 6, 2026
820f475
fix: Address some clippy warnings
HalavicH Jan 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ members = [
#

"tooling/perf",
"tooling/xtask",
"tooling/xtask", "crates/csv_preview",
]
default-members = ["crates/zed"]

Expand Down Expand Up @@ -283,6 +283,7 @@ copilot = { path = "crates/copilot" }
crashes = { path = "crates/crashes" }
credentials_provider = { path = "crates/credentials_provider" }
crossbeam = "0.8.4"
csv_preview = { path = "crates/csv_preview"}
dap = { path = "crates/dap" }
dap_adapters = { path = "crates/dap_adapters" }
db = { path = "crates/db" }
Expand Down
24 changes: 24 additions & 0 deletions assets/keymaps/default-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,30 @@
"alt-down": "markdown::ScrollDownByItem",
},
},
{
"context": "CsvPreview",
"bindings": {
"ctrl-c": "csv::CopySelected",
"escape": "csv::ClearSelection",
"up": "csv::SelectUp",
"down": "csv::SelectDown",
"left": "csv::SelectLeft",
"right": "csv::SelectRight",
"shift-up": "csv::ExtendSelectionUp",
"shift-down": "csv::ExtendSelectionDown",
"shift-left": "csv::ExtendSelectionLeft",
"shift-right": "csv::ExtendSelectionRight",
"ctrl-a": "csv::SelectAll",
"ctrl-up": "csv::SelectAtTopEdge",
"ctrl-down": "csv::SelectAtBottomEdge",
"ctrl-left": "csv::SelectAtLeftEdge",
"ctrl-right": "csv::SelectAtRightEdge",
"ctrl-shift-up": "csv::ExtendSelectionToTopEdge",
"ctrl-shift-down": "csv::ExtendSelectionToBottomEdge",
"ctrl-shift-left": "csv::ExtendSelectionToLeftEdge",
"ctrl-shift-right": "csv::ExtendSelectionToRightEdge"
}
},
{
"context": "KeymapEditor",
"use_key_equivalents": true,
Expand Down
32 changes: 32 additions & 0 deletions assets/keymaps/default-macos.json
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,38 @@
"alt-down": "markdown::ScrollDownByItem",
},
},
{
"context": "CsvPreview",
"bindings": {
"cmd-c": "csv::CopySelected",
"escape": "csv::ClearSelection",
"up": "csv::SelectUp",
"down": "csv::SelectDown",
"left": "csv::SelectLeft",
"right": "csv::SelectRight",
"shift-up": "csv::ExtendSelectionUp",
"shift-down": "csv::ExtendSelectionDown",
"shift-left": "csv::ExtendSelectionLeft",
"shift-right": "csv::ExtendSelectionRight",
"cmd-a": "csv::SelectAll",
"cmd-up": "csv::SelectAtTopEdge",
"cmd-down": "csv::SelectAtBottomEdge",
"cmd-left": "csv::SelectAtLeftEdge",
"cmd-right": "csv::SelectAtRightEdge",
"cmd-shift-up": "csv::ExtendSelectionToTopEdge",
"cmd-shift-down": "csv::ExtendSelectionToBottomEdge",
"cmd-shift-left": "csv::ExtendSelectionToLeftEdge",
"cmd-shift-right": "csv::ExtendSelectionToRightEdge",
"enter": "csv::StartCellEditing",
},
},
{
"context": "TableCellEditor",
"bindings": {
"enter": "csv::FinishCellEditing",
"escape": "csv::CancelCellEditing",
},
},
{
"context": "KeymapEditor",
"use_key_equivalents": true,
Expand Down
24 changes: 24 additions & 0 deletions assets/keymaps/default-windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,30 @@
"alt-down": "markdown::ScrollDownByItem",
},
},
{
"context": "CsvPreview",
"bindings": {
"ctrl-c": "csv::CopySelected",
"escape": "csv::ClearSelection",
"up": "csv::SelectUp",
"down": "csv::SelectDown",
"left": "csv::SelectLeft",
"right": "csv::SelectRight",
"shift-up": "csv::ExtendSelectionUp",
"shift-down": "csv::ExtendSelectionDown",
"shift-left": "csv::ExtendSelectionLeft",
"shift-right": "csv::ExtendSelectionRight",
"ctrl-a": "csv::SelectAll",
"ctrl-up": "csv::SelectAtTopEdge",
"ctrl-down": "csv::SelectAtBottomEdge",
"ctrl-left": "csv::SelectAtLeftEdge",
"ctrl-right": "csv::SelectAtRightEdge",
"ctrl-shift-up": "csv::ExtendSelectionToTopEdge",
"ctrl-shift-down": "csv::ExtendSelectionToBottomEdge",
"ctrl-shift-left": "csv::ExtendSelectionToLeftEdge",
"ctrl-shift-right": "csv::ExtendSelectionToRightEdge"
}
},
{
"context": "KeymapEditor",
"use_key_equivalents": true,
Expand Down
28 changes: 28 additions & 0 deletions crates/csv_preview/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "csv_preview"
version = "0.1.0"
publish.workspace = true
edition.workspace = true

[lib]
path = "src/csv_preview.rs"
doctest = false

[dependencies]
anyhow.workspace = true
gpui.workspace = true
editor.workspace = true
ui.workspace = true
workspace.workspace = true
log.workspace = true
derive_more.workspace = true
text.workspace = true
menu.workspace = true

# Needed to compile fork of `data_table.rs`
itertools.workspace = true
ui_macros.workspace = true
component.workspace = true

[lints]
workspace = true
1 change: 1 addition & 0 deletions crates/csv_preview/LICENCE-GPL
147 changes: 147 additions & 0 deletions crates/csv_preview/PROGRESS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# CSV Preview Progress Tracker

This document outlines the current state of the POC feature. It might not be the most understandable document for others, but the feature author depends on it to track progress and ideas.

## Problems to Discuss
**Data table limitations**:
- Const generics. Switch to dynamic arrays
- Awkward table width configuration (can't really make the table wider than parent automatically). If width is set statically to be bigger than the parent, scrolling needs to be enabled separately, despite it's stated, that it should work automatically.
- Column widths are calculated via %, and not absolute units. This way it's not possible to calculate whole table based on width of each column.
- Can't pin first column (row numbers). This results in bad UX when scrolling horizontally (row numbers move out of viewport, and it becomes hard to reason about rows)

**Column Resizing Behavior: Current vs. Needed**

- **Current approach:**
The data table uses **proportional (fluid) resizing**. When you adjust a column’s width, the space is redistributed among other columns so the overall table width stays the same.

- **Limitations:**
- The table’s width cannot be determined by simply summing up individual column widths.
- The table cannot naturally expand beyond its parent container.
- This makes it difficult to handle CSV files with columns of widely varying content lengths.

- **Desired approach:**
**Independent (absolute) resizing**—like in Google Sheets or Excel:
- Each column can be resized without affecting others.
- The table’s total width grows or shrinks as columns are resized.
- This allows the table to expand beyond its parent and enables intuitive horizontal scrolling.

## Progress

### Table: UI/Behavior

**Features:**
- [x] feat: Smart debouncing (now + cooldown instead of dumb waiting)
- [x] feat: Add tooltip to show full value on hover
- [x] feat: Add performance metrics (timings for sorting, parsing, copying, selection, etc)
- [ ] feat: Add multiline cells (variable list) / single line cells (unified list) modes
- [ ] feat: Optional headers (c1 c2 c3) toggle
- [ ] feat: Horizontal scroll vs fit all columns (**need infra**)
- [ ] feat: Update column resizing behavior (double-click column boundary to fit to content, again to fit to column name, again to reset)
- [ ] feat: Add persisting of the state of opened previews on editor restart
- [ ] feat: Add `CsvPreviewView` settings persistence (probably need to add them to settings.json)
- [ ] feat: Generalize the preview to support .tsv files (maybe even all files, and prompt user to select format if it's not .csv/.tsv)

**Fixes:**
- [x] fix: Vertical scrolling doesn't work in variable list rendering mode
- [ ] fix: Variable and Uniform lists have the separate scrolls. TODO: sync them
- [ ] fix: VariableList has no scroll bar, and scroll step is different from UniformList

### Table: Minor UI Tweaks

**Features:**
- [ ] feat: Make uniform background + add horizontal lines between cells
- [x] feat: Monospace font (with toggle)

**Fixes:**

### Row Identifiers (Line Numbers)

**Features:**
- [x] feat: Make width not resizable manually, but adjust to file size (number of lines)
- [x] feat: Highlight number of selected (focused) line
- [x] feat: Add numbering type: lines/rows

**Fixes:**
- [ ] fix: Calculate width of a character (currently hardcoded)
- [x] fix: Update implementation to correspond to actual numbers in the source code (broken in multiline CSV rows)

### Selection

**Features:**
- [x] feat: Update paddings (same for selected and not selected columns)
- [x] feat: Add multiple selections using cmd modifier
- [x] feat: Clear selection
- [x] feat: Navigate with keyboard
- [x] feat: Extend selection with keyboard
- [x] feat: Optimize selection by using `SelectionStrategy`:
```rust
enum SelectionStrategy {
/// Whole document (CMD+A)
AllCells,
/// Single cell or single range selected
SingleChunk(Chunk),
/// Multiple chunks selected while holding CMD
MultipleChunks(Vec<Chunk>)
}
enum Chunk {
/// Single cell
Cell(DisplayCellId),
/// Square range of cells
Range(DisplayCellId, DisplayCellId)
}
```
- [ ] feat: Convert adjacent cells selected individually into a range if range is single dimention (1xN or Nx1)
- [x] feat: Move viewport by keyboard selection
- [x] feat: Move viewport by mouse selection

**Fixes:**
- [x] fix: Selection when sorted (follow data cells not display cells)

### Copy Selected

**Features:**
- [x] feat: Add copying by Ctrl+C
- [x] feat: Add copy as (CSV, TSV, markdown table, semicolon separated)
- [x] feat: Copy in display mode (what you see) not data mode (how it's in file), or toggle between them

**Fixes:**

### Sorting by column

**Features:**
- [x] feat: Add tooltip on sort button
- [ ] feat: Add manual ordering of columns by dragging (**needs infra**)

**Fixes:**
- [ ] fix: Focus/anchor cells are don't follow the ordered celection

### Filtering

**Features:**
- [x] feat: Implement initial filtering by column
- [x] fix: Hide filtered out rows from filterables in adjacent columns (stacked filtering)
- [ ] fix: Sometimes stacked filtering implementation is too restrictive (especially with nulls). Investigate and fix
- [ ] feat: Update the filter popover to be persistent and with better ui
- [ ] feat: Add search bar for filtering popover

**Fixes:**

### Editing

**Features:**
- [x] feat: Inline edits (click cell to enter editor mode. Edit text, hit enter, and changes applied to original file)
- [x] feat: Add virtual cell editing support (pad cells with delimiter, if row is less than number of columns for the table)
- [x] fix: Allow overflow for the editor. Style editor to have background, border and paddings
- [ ] fix: Add z-index, to be on top of adjacent cells
- [ ] fix: Overflow doesn't work correctly if it's set in any child div instead of parent div
```rust
// Works correctly
div().overflow_hidden().child(div().child(some_child));
// Broken: on overflow, few pixels is still visible, is dynamic, depends on overall width of the cell
div().child(div().overflow_hidden().child(some_child));
```
- [ ] feat: Apply ordering settings (permanently write to buffer current rows and columns order)
- [ ] feat: Paste from clipboard over several cells (parse based on defined separator). Allow only in `AllCells` / `SingleChunk` selection modes
- [ ] feat: Add edit history with undo/redo

**Fixes:**
28 changes: 28 additions & 0 deletions crates/csv_preview/src/action_handlers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use gpui::ListAlignment;

use crate::{CsvPreviewView, types::AnyColumn};

mod copy_selected;
mod selection_handlers;

impl CsvPreviewView {
pub fn clear_filters(&mut self, col_idx: AnyColumn) {
self.engine.clear_filters_for_col(col_idx);
self.engine.apply_filtering();
self.list_state = gpui::ListState::new(
self.engine.d2d_mapping().visible_row_count(),
ListAlignment::Top,
ui::px(1.),
);
}

pub fn toggle_filter(&mut self, col_idx: AnyColumn, content_hash: u64) {
self.engine.toggle_filter(col_idx, content_hash);
self.engine.calculate_d2d_mapping();
self.list_state = gpui::ListState::new(
self.engine.d2d_mapping().visible_row_count(),
gpui::ListAlignment::Top,
ui::px(1.),
);
}
}
Loading