-
-
Notifications
You must be signed in to change notification settings - Fork 337
feat(inspector): switch the CSV first row between header and data #1942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -217,6 +217,10 @@ final class InspectorViewController: NSViewController, NSUserInterfaceValidation | |
| handleDeleteRows(state.selectedRowIndices) | ||
| } | ||
|
|
||
| @objc func inspectorToggleHeaderRow(_ sender: Any?) { | ||
| inspectorDocument?.toggleHeaderRow() | ||
|
Comment on lines
+220
to
+221
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a row is selected, this action changes the backing row indices but leaves Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| @objc func inspectorInsertRowAbove(_ sender: Any?) { | ||
| performInsertRow(anchoredBy: sender, below: false) | ||
| } | ||
|
|
@@ -588,7 +592,8 @@ final class InspectorViewController: NSViewController, NSUserInterfaceValidation | |
| #selector(toggleInspectorFilter(_:)), #selector(inspectorAddRow(_:)), | ||
| #selector(inspectorInsertRowAbove(_:)), #selector(inspectorInsertRowBelow(_:)), | ||
| #selector(inspectorInsertColumnLeft(_:)), #selector(inspectorInsertColumnRight(_:)), | ||
| #selector(inspectorSplitColumn(_:)), #selector(inspectorMergeColumns(_:)): | ||
| #selector(inspectorSplitColumn(_:)), #selector(inspectorMergeColumns(_:)), | ||
| #selector(inspectorToggleHeaderRow(_:)): | ||
| return nsDocument != nil | ||
| case #selector(inspectorDeleteColumn(_:)): | ||
| guard nsDocument != nil else { return false } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After promoting a headerless CSV and then adding or removing a column without toggling the header back off, this stores the promoted header as a fixed
headerRefwhileinsertColumn/removeColumnupdate onlycolumnNamesand data rows.CSVWritersubsequently writes that stale header source, so, for example, promoting1,2\n3,4\n, adding columnc, and saving produces a two-cell header followed by three-cell data rows; the new column name is lost and the saved CSV has mismatched widths.Useful? React with 👍 / 👎.