Commit Graph
3333 Commits
Author SHA1 Message Date
Michael Higgins a3119f57c2 xlsx/csv: cap secondary reader allocations (#2159) (#2199)
* xlsx/csv: cap secondary reader allocations (#2159)
  
  - XML: at most 1M children per element, 16,384 per worksheet row (TooLarge).
  - Workbook-wide cap of 16M cell elements.
  - Array-formula ranges indexed by row (budgeted), not scanned per cell.
  - <cols> writes share a 4M budget.
  - At most 4096 sheets; duplicate names deduplicated with a HashSet.
  - Pivot: field lists capped, repeated fields used once, labels borrowed.
  - CSV: fields past MAX_COLS dropped while reading the record.
  - At most 4M shared strings.
  - Relationships looked up by id through a HashMap.

* xlsx: close the remaining secondary-reader cap gaps (#2159)
  
  - CSV: characters of a field past column 16,384 are not stored; quotes,
    delimiters and line ends in it are still followed.
  - Pivot: a field list cut at MAX_FIELDS is reported with a warning.
  - Sheet names: the prefix shortens once the (n) suffix passes (999), so
    deduplicated names stay within 31 characters.
  - Rows dropped for a bad row number still charge their <c> elements
    against MAX_CELLS.
  - Test Ctx helper gains the fields upstream added.

* #2159: describe MAX_CELLS as the reader's own cap
  
  calc::eval::MAX_CELLS has the same value but limits one array result,
  not a workbook.

* #2159: warn on capped pivot cache fields, dedupe pivot names through sets
  
  A cache cut at 16,384 fields is now reported, as the table field lists
  are. Axis filters and calculated fields are deduplicated through a set
  of lower-cased names instead of a scan per field, which was quadratic in
  the 16,384 fields allowed; the first of names equal but for case still
  wins.
2026-11-18 16:36:37 +07:00
NetterSilver 272ae54101 Delete separate rows or columns in one pass (#2385)
* Delete separate rows or columns in one pass
  
  Fixes #2287
2026-11-18 16:35:49 +07:00
NetterSilver bf48def687 Create new saved files without group/other write permission (#2567)
* Create new saved files without group/other write permission
  
  Fixes #2519
2026-11-18 16:35:20 +07:00
Michael Higgins dbf674ef48 links: spawn the Windows opener by absolute path (#2176) (#2204)
* links: spawn the Windows opener by absolute path (#2176)
  
  Explorer is now spawned as %SystemRoot%\explorer.exe (falling back to
  windir, then C:\Windows; only local drive paths are accepted), so an
  explorer.exe planted next to the app or in the CWD can't run. Space, ",
  comma and ^ are percent-encoded before Explorer parses its command line.
  macOS uses /usr/bin/open; a target starting with - or / is refused on
  every platform so it can never become an opener option.

* links: rename opener enum variant (clippy)
  
  `Os::MacOs` -> `Os::Mac` (clippy::enum_variant_names). Also give the
  desktop-theme watcher's non-Linux `Link` a non-unit type so
  clippy::let_unit_value stops firing on Windows/macOS.

* ui: leave desktop_theme Link alone (covered by #2141)

* #2176: say why the Explorer escape still encodes commas
2026-11-18 16:34:32 +07:00
FredApps 644861c132 Merge pull request #449 from neilcawse/fix/main-ci-csv-tests
CSV/text export: General numbers without exponents (integers below 1e16 exact); `&` switches to scientific past 21 characters
2026-11-18 16:34:02 +07:00
FredApps c8450fd1e5 Merge pull request #3784 from dotCooCoo/chore/craft-update-6e03f65
Updates: take craft-update from craft-libs main at e98299546
2026-11-18 16:28:11 +07:00
FredApps a492d8031a Merge pull request #3574 from SBaksa/intl-no-xlfn
XLSX: NETWORKDAYS.INTL and WORKDAY.INTL are saved without _xlfn. (fixes #3517)
2026-11-18 16:27:48 +07:00
FredApps 5b1d89f867 Merge pull request #3047 from quantforge-br/function-help-portuguese
UI: Brazilian Portuguese function help
2026-11-18 16:27:25 +07:00
FredApps 1f0d416f74 Merge pull request #3046 from quantforge-br/fix/spill-priority
Calc: a contested spill area stays with its array on full recalc and reopening (#964)
2026-11-18 16:27:02 +07:00
bmh129 82c97858df Linux: run on native Wayland again by default (revert #165) (#2789)
* Linux: run on native Wayland again by default (revert #165)
  
  winit 0.30.13 reported dropped files only on X11. The egui 0.37 migration
  (#2543) pins storytold/winit, whose patch W15 reports file drops through
  a per-seat Wayland data device (rust-windowing/winit#4729), so files
  dragged from the file manager open on native Wayland too. The XWayland
  default is no longer needed.
  
  It also costs a startup crash: winit's X11 backend loads
  libxkbcommon-x11, which the Linux packages don't depend on. Where it's
  missing (a Fedora toolbox, minimal installs), GridCraft panics before the
  window opens: "Library libxkbcommon-x11.so could not be loaded."
  
  Checked on GNOME (Wayland, Fedora 44) with a build of main plus other
  proposed changes, run with GRIDCRAFT_WAYLAND=1 (the path this revert
  makes the default): an .xlsx and a .csv dragged from Files each open as a
  workbook, and the app starts without libxkbcommon-x11 installed.
  
  This reverts commit 6f0e43c21c.
  
  Claude-Session: https://claude.ai/code/session_01Rvu8dWh26U2fsLQMSBQfH8
2026-11-18 16:26:39 +07:00
Zaxaerith 20c5742f79 fix(web): mark PDF exports in gridcraft:save (#2452) (#2535)
* fix(web): distinguish PDF exports in host save messages (#2452)
2026-11-18 16:26:01 +07:00
FredApps 21def4fa1a Merge pull request #2303 from MarekSpodBiedry/issue-2285
XLSX: write spilled text as cached strings, not shared strings (#2285)
2026-11-18 16:23:35 +07:00
FredApps 61ee368369 Merge pull request #2298 from dfendr/fix/table-style-looks
Tables: Give each style row its own look
2026-11-18 16:23:13 +07:00
FredApps d1a5c9671f Merge pull request #2293 from storytold/test/backfill-regression-tests
Regression tests for #223, #360 and #1485
2026-11-18 16:22:51 +07:00
Dominik Strebel 12dd9aea9b test: header AutoFit check measures the text as AutoFit did (#2273)
* test: header AutoFit check measures the text as AutoFit did
  
  table_filter_autofit_works_through_command_and_header_double_click
  compared the autofitted column with the engine's text-width estimate,
  but in the app AutoFit measures with the installed fonts
  (Session::text_width). Where those are narrower than the estimate (a
  Mac with Carlito, metric-compatible with Calibri), the estimate
  "overlapped" the filter button and the test failed on main. It now
  measures with the same function AutoFit used.

* test: the header AutoFit UI check measures with the app's fonts, which the app always installs
  
  The fallback to the engine's estimate never ran: SheetApp::logic installs the measure before
  AutoFit. AutoFit on the estimate is covered by the engine's autofit_filter_buttons tests.
2026-11-18 16:22:30 +07:00
FredApps 6980b00dac Merge pull request #2040 from alphazw/fix/ime-first-keystroke-bypasses-composition
IME: the first keystroke of a composition no longer lands in the cell
2026-11-18 16:22:08 +07:00
FredApps f36eaf3fbe Merge pull request #1960 from Hamza0101/checkbox-space
Space on a checkbox cell toggles it and nothing else
2026-11-18 16:21:31 +07:00
Vedran Doboš 12e1b5379b Keyboard: punctuation shortcuts follow the character the layout types (#1384) (#1385)
* Keyboard: punctuation shortcuts follow the character the layout types (#1384)
  
  On a Croatian or German keyboard Shift+, types `;`, so Excel inserts the
  date with Ctrl+Shift+,. GridCraft matched the key's US position and ran
  Decrease Font Size. Punctuation keys now go by the character typed
  (translated to the US key and Shift that type it), digits keep their
  position, and a character egui has no key for (č, ö) still falls back to
  the position. ribbon::shortcut reads the same key, so Ctrl+Shift+0
  typing `=` unhides columns instead of opening Insert, and Ctrl++ opens it.

* Keyboard: Cmd+Shift+; on a Mac doesn't insert today's date (review)
  
  ribbon::shortcut's Semicolon arm took Shift too, so the US-key mapping turned Cmd+Shift+; (and
  Cmd+Shift+. on a Croatian or German layout) into the date. Ctrl+Shift+; stays the time.

* Keyboard: tests for AZERTY and Czech, and for typing while a cell is edited (#1384)
  
  French AZERTY (`;` and `:` unshifted on the US `,` and `.` keys) and Czech (`;` on the US
  backtick key, `:` Shift+.) give the date and the time with Ctrl. The layout mapping runs only
  in the grid, which reads no shortcuts while a cell is edited; a test pins that: `;` and `:` typed
  as Shift+, and Shift+. on a Croatian or German keyboard go into the cell, and the font size stays.
2026-11-18 16:20:40 +07:00
bea2191b35 Fuzzer: undo checks follow the bounded undo history (#2332)
* Fuzzer: undo checks follow the bounded undo history

The undo history drops its oldest steps past 100 entries or 128 MB of snapshots (#1263). The
command-sequence fuzzer still compared "undo everything" with the episode's starting workbook,
so any episode whose snapshots passed the budget failed with "undoing all N steps doesn't give
back the starting workbook" although undo worked (seeds 104, 110 and 163 at 80 steps: a column
inserted next to whole-column borders, or rows deleted after filling whole columns, each made a
100 MB step).

The harness notices when an undoable command changed the workbook without the history growing,
and then compares with the state before the oldest step still in the history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fuzzer: undo and redo checks follow the reachable history boundary

Review of #2332. The harness now tracks the oldest state the undo history
can reach instead of a trimmed flag: whenever the history's oldest entry
changes without it emptying in between, the history dropped a step, and
undoing everything stops at the new oldest entry. That boundary is kept
when an edit.undo in the sequence uses up the retained history before the
episode ends, which used to fall back to the episode's start and report a
false undo mismatch.

The redo round trip no longer assumes n undos leave n redo entries: the
redo history is bounded too, so when it dropped the first step undone,
redo is expected to stop at the oldest entry it kept.

---------

Co-authored-by: nihilist-narwhal <240798405+nihilist-narwhal@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 22:36:17 -06:00
Neil Cawse 620174e069 Merge remote-tracking branch 'upstream/main' into fix/main-ci-csv-tests 2026-11-18 04:18:44 +00:00
Valentin KleinandClaude Opus 5.5 4c388df949 Flush a saved workbook to disk before replacing the old one (#3178)
* Flush a saved workbook to disk before the rename

write_file renamed the temporary file over the workbook without sync_all, so a power loss right after a save could leave an empty or truncated file under the workbook's name. Sync the file before the rename and, on unix, sync the folder after it (best effort).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Tolerate file systems that cannot flush when saving

On Apple targets std's sync_all asks for F_FULLFSYNC, which network mounts refuse with ENOTTY or ENOTSUP. Treat exactly those errors (and ErrorKind::Unsupported) from the temp file's sync as 'cannot flush here' and carry on with the rename, as before the flush was added. All other errors still fail the save.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Treat raw error 25 as unsupported-flush only on Unix

On Windows 25 is ERROR_SEEK, a real failure that must not be skipped.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Save: treat Apple's ENOTSUP from F_FULLFSYNC as unsupported flush

On Apple targets ENOTSUP is 45 and std leaves it uncategorized (only
EOPNOTSUPP, 102, and ENOSYS map to ErrorKind::Unsupported), so a volume
refusing F_FULLFSYNC with ENOTSUP failed the save and deleted the
temporary file. The raw code is now matched on Apple targets only;
elsewhere 45 is a different errno and stays a failed save. The check is
split into a platform-parameterised helper so each platform's codes are
tested on any host, plus an Apple-only test on the real helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 08:44:04 +07:00
Cheejyg 807cf23b02 Sort: Custom Sort dialog redesign (#1593)
* Sort: Custom Sort dialog redesign

* Sort: keep the dialog on its worksheet and open when sorting fails

* Improve custom sort dialog and localisation

Localise sort controls and adapt their layout to translations. Track worksheets by identity, restore selections across sheet changes, and allow additional levels to reuse columns.

* Fix sort dialog worksheet and input handling

Open Sort on the requested worksheet, reject invalid ranges, and close any open filter menu so Enter confirms the sort. Add regression tests for each case.
2026-11-18 08:43:41 +07:00
Neil Cawse 24f58a2ee4 Merge remote-tracking branch 'upstream/main' into fix/main-ci-csv-tests 2026-11-17 13:24:58 +00:00
Neil Cawse 319a3e4c2e Merge remote-tracking branch 'upstream/main' into fix/main-ci-csv-tests 2026-11-17 04:15:59 +00:00
Dylan M. Taylor d60709a173 pdf: follow up shared writer cutover with merged-library pin (#4407) 2026-11-16 22:44:24 -05:00
Dylan M. Taylor 0e5a82f084 ci: lock workflow actions through an actions.lock lockfile (#3879) 2026-11-16 21:58:36 -05:00
Dylan M. Taylor 4c943670cf pdf: move object and xref envelope writing to craft-pdf (#4398) 2026-11-16 21:58:31 -05:00
quantforge-br cf5e91ed5e Merge upstream/main into function-help-portuguese
# Conflicts:
#	docs/localization-parity.md
2026-11-16 23:13:57 -03:00
Dylan M. Taylor c8e69968c7 Merge pull request #4262 from vangel76/fix/ratex-parse-messages-i18n
Equation parse errors follow the interface language
2026-11-16 20:36:10 -05:00
Dylan M. Taylor 79742499b5 Merge pull request #3626 from vangel76/fix/i18n-hardcoded-strings
Status bar statistics, resize tips, sheet notes and macro toasts follow the interface language
2026-11-16 20:35:16 -05:00
Dylan M. Taylor d0f20a31da Merge pull request #4165 from vangel76/fix/4161-equation-fallback-font
Equation fallback text in xlsx is drawn at a normal font size
2026-11-16 20:32:51 -05:00
dotCooCoo 10506a1f1d Merge main into chore/craft-update-6e03f65 2026-11-16 17:09:15 -08:00
Dylan M. Taylor 7e4235c85b Merge pull request #4399 from storytold/dot/shared-xstring-20261117
xlsx: share SpreadsheetML string reader/writer codec (cutover stage 1)
2026-11-16 20:00:52 -05:00
Dylan M. Taylor ef87aaa590 test(xlsx): retain XML predicate for escaping oracle 2026-11-16 19:45:33 -05:00
Dylan M. Taylor 4ebc9a5127 Merge remote-tracking branch 'origin/main' into dot/shared-xstring-20261117 2026-11-16 19:44:21 -05:00
Dylan M. Taylor fc7698eb11 Merge pull request #4383 from Hamza0101/fix/table-hidden-total-row-keeps-calc
XLSX: a hidden Total Row keeps its calculations
2026-11-16 19:43:58 -05:00
Dylan M. Taylor 058ea183ec Merge pull request #4382 from Hamza0101/fix/xlsx-first-page-number
XLSX: keep Page Setup's first page number
2026-11-16 19:43:34 -05:00
Dylan M. Taylor faef1a06c8 xlsx: use shared SpreadsheetML string codec in reader and writer 2026-11-16 19:40:39 -05:00
vangel76 0c8e2f850e Merge fix/i18n-hardcoded-strings into fix/ratex-parse-messages-i18n 2026-11-16 21:55:34 +01:00
vangel76 54ebc232fb Merge upstream/main into fix/i18n-hardcoded-strings 2026-11-16 21:52:37 +01:00
Hamza 8d8716cdc0 XLSX: a hidden Total Row keeps its calculations
A table whose Total Row was turned off still holds each column's total:
Excel writes totalsRowFunction, totalsRowLabel and a custom
totalsRowFormula without totalsRowCount, and restores them when the row
is turned back on. The reader took them, but the writer wrote them only
while the row was shown, so a save lost a custom formula or an Average
and Excel brought back SUBTOTAL(109,...) instead. They are now written
whether the row is shown or not.

Fixes #4296
2026-11-16 20:10:00 +05:00
Hamza 496c13e7b4 XLSX: keep Page Setup's first page number
A sheet set to First page number 7 has pageSetup firstPageNumber="7"
useFirstPageNumber="1"; neither attribute was read, so a save reset it
to Automatic. PrintSettings now holds it (None for Automatic), the
reader takes the number when useFirstPageNumber is on, and the writer
writes both in the schema's order. A JSON workbook leaves it out when
Automatic, so existing files are written as before.

Fixes #4293
2026-11-16 20:04:07 +05:00
FredApps abcfc19153 Merge pull request #4364 from storytold/docs/shared-library-guidance
docs: prefer shared Craft libraries for reusable features
2026-11-16 13:51:45 +01:00
Dylan M. Taylor 3ca81a761b docs: prefer shared Craft libraries for reusable features 2026-11-16 06:27:17 -05:00
FredApps 1476d4e7ab Merge pull request #4184 from ZIDAN44/fix/3945-subtotal-grand-total-outline
engine: Subtotal groups every row under the grand total (#3945)
2026-11-16 10:25:43 +01:00
FredApps 91f153de5b Merge pull request #4247 from gmrmad1/docs/roadmap-2026-11-15
docs: bring ROADMAP.md and parity assessment current through 2026-11-15
2026-11-16 10:24:34 +01:00
FredApps 3443e06bfc Merge pull request #4183 from ZIDAN44/fix/3934-paste-row-down-narrow-selection
engine: paste repeats a copied row down a taller, narrower selection (#3934)
2026-11-16 10:24:21 +01:00
FredApps e1147239fc Merge pull request #4182 from ZIDAN44/fix/3949-custom-list-unlisted-sort
engine: custom-list sort puts unlisted values A to Z after the list (#3949)
2026-11-16 10:21:26 +01:00
Valentin KleinandClaude Opus 5.5 ef99f1e51f Functions: GETPIVOTDATA (#284) (#290)
* Functions: GETPIVOTDATA (#284)

The engine records each PivotTable report value cell (value field,
row/column items, value) on refresh and when a workbook is opened;
GETPIVOTDATA is an evaluator special form that looks the value up by
value field and field/item pairs, #REF! when the report doesn't show it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* GETPIVOTDATA: shared lazy index, report values, hash lookup (review of #290)

- PivotTable::data_index is an Arc-shared PivotLookup (serde-skipped), so the
  per-command workbook clone no longer copies the index; refresh sets it, clear resets it.
- No index work on open: the first GETPIVOTDATA on a pivot without one builds it from the
  source via the engine-registered PIVOT_INDEXER; a failure is #REF!, not an empty index.
- The result is the value the sheet shows at the cell's report position, so formula and
  report cell agree (test with a source edited after the last refresh).
- Lookup by a pre-lowercased hash key; numbers/booleans fall back to a scan on a miss.
- GETPIVOTDATA is no longer volatile: it depends on its pivot's whole report area.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* GETPIVOTDATA: keep the index of the stored report; collision-free keys; align estimates

The lookup index describes the report as last refreshed and is saved with
the pivot. A pivot loaded without one (XLSX) only builds it when the
recomputed layout matches the stored labels. Lookup keys are length-prefixed
and distinguish Boolean from text items. Function-parity estimates match.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* pivot: import PivotDataCell, PivotItemRef and PivotLookup explicitly after upstream dropped the glob import

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* pivot: add an ignored measurement of edits on a sheet with a large report

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* pivot: keep a failed lazy GETPIVOTDATA build retryable, never save an empty index

A failed lazy index build stored unwrap_or_default() into the shared,
first-set-wins PivotLookup, so a valid state coming later (undo, a
source fix, a reopen) could never rebuild it, and the empty list was
saved as a restored index. Cache only validated builds, treat an empty
list as no index in serialization, reject reports with more value
cells than the index cap instead of truncating, register the pivot
indexer in gridcraft-cli check, and add two regression tests.

* GETPIVOTDATA: move cached offsets with edits inside the report; exact numeric items first

Inserting or deleting rows or columns inside a report remapped the cells
and last_range but kept the cached value-cell offsets, so a lookup could
read another item's cell. shift_sheet_features now maps each indexed
cell through the edit into a new index (the shared one stays with the
undo snapshots); a value cell deleted with its line drops out (#REF!).

A numeric item was accepted on a formatted-label hash hit, so 0.6 and 1
both shown as "1" returned the first. A number now prefers the cell
whose item has exactly that value, before any label match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fix pivot chart test for the new Output.data field

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:59:28 +01:00
dotCooCoo 47b67127d5 Merge main into chore/craft-update-6e03f65 2026-11-15 17:56:30 -08:00