mirror of
https://github.com/storytold/gridcraft.git
synced 2026-12-02 02:33:55 -06:00
9eb7b3bdb8d40458129b6575fb730ba1f470f3f5
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f9af787c7b |
Dropdown filter (#2119)
* Searchable validation dropdown lists * double dropdown bug solved * performance improvements for dropdown list filtering * docstrings and documentation added * precisions regarding accented characters for dropdown list search * Latin extended characters added to accent list in dropdown list search * formula bar check button handled as enter for highlighted entry * capping list at 10,000 entries * Bound the searched validation list's source work A searched list (data.validationList, and the edit that typing into a list cell opens) read its whole source first: a whole-column list evaluated every cell into an array and folded each entry, so a search with few or no matches could still stall the UI. The search now reads at most LIST_SOURCE_BUDGET (200,000) cells of the source: a range is walked cell by cell instead of evaluated, a computed source gets the budget as its formula work, and `truncated` reports when the source was cut short. The popup says when entries aren't shown. The validation membership check still reads the whole list. * Bound the dropdown arrow's validation list The full list that the dropdown arrow or Alt+Down opens called list_items every frame while it was open and drew a button for every entry, so a list over a huge column reread its source and laid out all of it on each repaint. It now reads the list once with list_search_source (within LIST_SOURCE_BUDGET), keeps it while the popup stays open on the same cell of the same workbook version, and draws only the rows in view, saying when entries aren't shown. Rows are measured at their real button height, so the popup shows the eight rows it was meant to (it showed six). * Dropdown list fixes 1. Row height: the search popup now measures its rows at the real button height, through a helper shared with the arrow picker. It shows eight rows, the highlight stays in view and the end of a long list is reachable. 2. Duplicate call: the second e.update_list() in control.rs is gone. 3. Stale cache: list_picker_items is cleared wherever list_picker is cleared for an edit (start_edit and the editor branch of list_picker). 4. Translation: "More entries not shown" is one constant and goes through lang.tr(...) in both popups. I did not add catalog entries, so it still shows in English in every language until translations are written. 5. Flip above: the search popup opens above the cell when it would run past the bottom of the window, using the same rule as the arrow picker. 6. Width: the popup width is measured once per search and cached in ListSearch::text_width; update_list resets it. * Validation lists: fixed-height rows, translated cut-short note The rows of both validation list popups are drawn in slots of exactly the height the popup scrolls by. A button sizes itself to its laid-out text, which can be a pixel taller than the font's nominal line height, so the last visible row ran under the "More entries not shown" note with the pinned test fonts (the CI gate failure). The note is translated in all 18 interface catalogs, with a test that no catalog falls back to English. The validation-list UI tests move into the shared integration binary and use the pinned font harness, so they no longer depend on host fonts. * Validation list note: use each catalog's word for list items --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: skylartaylor <skylartaylor@users.noreply.github.com> |
||
|
|
8a7fe1bec2 |
engine, model: one workbook-wide reference rewrite; rule formulas follow their ranges (ODS groundwork) (#4136)
* engine, model: one workbook-wide reference rewrite; rule formulas follow their ranges Workbook::rewrite_references(&dyn Fn(RefHost, Expr) -> Expr) is the single walker over every place a workbook holds a reference: cell formulas (keeping array range and spill kind), defined names, conditional formats, validation, in-workbook links, chart series and sources, sparklines and PivotTable sources. Sheet rename and delete, defined-name and table rename, row/column and cell insert/delete and cut-paste all go through it instead of their own lists of holders, so a rename now also reaches pivot sources, rules and validations; inserting rows above a rule moves its formulas; deleting a sheet makes rule/validation references #REF! and no longer turns legacy arrays into spills; table rename keeps legacy arrays. A copied sheet's charts plot the copy. Conditional-format and validation formulas are re-hosted by how their ranges moved (rehost_rule, CfRule::relative_formulas_mut/formulas_mut, Validation::formulas_mut): deleting a rule's first row no longer makes it #REF!, ranges moved whole or left in place keep their formulas, thresholds are read as written. A cut takes rules with its cells (Rule trait, remove_rule_cells, moved_rule_parts) and moves their references once. A sheet-qualified name splits at its last '!' when a sheet is renamed. * engine, model: review fixes for the workbook-wide reference rewrite - rehost_rule takes the rule's top-left from all its ranges before the edit, so removing the range that held it (deleting its rows or cells) re-hosts the formulas instead of leaving #REF!. - Internal hyperlink targets are no longer rewritten: they keep the place they name as typed, as main and Excel do. - A cut can't be transposed or tiled by Paste Special (as in Excel); its rules and references followed the block unturned. - rewrite_references copies a sheet only when something on it changes, so untouched sheets stay shared with undo snapshots. - docs/architecture.md: revision row moved under Revision history; section updated. * engine, model: re-review touch-ups for the reference rewrite - The multi-area rehost test checks deleting the first area's cells both shifting up and shifting left (the comment said up, the test did left). - rewrite_references checks rules, validations, charts, sparklines and pivots on the borrowed sheet and copies a list only when something in it changes (CfRule::formulas, Validation::formulas, read-only). A chart source already holding #REF! is dropped by any rewrite again. * engine, model: round-2 review fixes for the reference rewrite - A cut to another sheet names the source sheet in all of a conditional format's formulas, thresholds included: a colour scale's, data bar's or icon set's threshold formula kept reading the destination sheet's cells. - A chart series name that is a bare word and not a defined name is a label, as the chart reads it: renaming a table of that name no longer rewrites it. Renaming a defined name rewrites formulas before the old name is dropped, so a series named by it still follows. - The walker's doc no longer lists deleting names among the edits that go through it; a test comment says what it checks. * engine, model: round-3 review fixes for the reference rewrite - A chart series name is left as written unless the chart reads it as a reference: it starts with `=`, names a sheet, or is a defined name its own sheet sees. A name scoped to another sheet, or a label shaped like a cell (`Q1`), is no longer rewritten (corrects round 2's check, which looked at names in every scope and only exempted bare words). - A chart source block is dropped as gone only when its formula holds `#REF!`, not its text: a sheet may be named `#REF!`. - Defined names are handed to the rewrite on `NAME_HOST` (`[]`), which no sheet name can be, instead of a NUL that a sheet could be renamed to. - The walker's doc and docs/architecture.md list a PivotChart's link and a slicer's table among what it does not visit. * engine: Move Columns takes its columns' rules along as a cut does A conditional format or validation wider than the moved columns was left in place by the move step while its formulas were moved as references into the block, so the cells left behind checked the wrong column and the moved column lost the rule. Move Columns now moves the rules' parts in the moved columns as Cut and Paste does (`move_cut_rules`), and the rest of the rule re-hosts from its new top-left cell. * engine: round-5 review fixes for the reference rewrite - Move Columns moves its rules before the columns' features shift (corrects round 4): moved left, a rule whose whole range was in the moved columns was shifted, re-hosted and then re-hosted again from mixed positions, so the parts left behind checked the wrong column. - Copying a sheet keeps a chart's series and source text as written unless it names the copied sheet: a series name `=A1` lost its `=` and was read as the label "A1". - Docs and comments say what the code does: `move_cut_rules` serves Move Columns too, `rewrite_all_formulas` and `rename_name_in_formulas` point at the walker, and docs/architecture.md names Move Columns; `sheet_rename_renames_a_pivot_source` is named for what it checks. * docs: architecture: a rule's one formula across a partial shift of its cells A conditional format or validation keeps one formula for all its cells, so an insert or delete inside its range, or Move Columns across it, leaves relative references at the cells on the far side of the shift reading where the top-left cell's reference puts them. * engine: review fixes for the reference rewrite (CodeRabbit) A cut moves the rules its cells hold when it is pasted, not the clipboard snapshot's: a rule cleared after the cut came back at the destination. A table rename leaves a bare name in a workbook name alone when a workbook-level defined name of that name exists, as it does in cells. * engine: a cut is not pasted skipping blanks A cut's rules replace the destination's under the whole block, so a Skip Blanks paste of it dropped validation under the cells it left alone. Paste Special now refuses Skip Blanks for a cut, as it already refuses Transpose and tiling (Excel offers none of them for a cut). * table.rename: a PivotTable table source follows even when a defined name shadows it A bare pivot source binds to the table before a defined name, so the shadowing that keeps formula names on the defined name does not apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * model: rewrite_references keeps a chart source that was already broken Only a source the edit breaks is dropped. A source already #REF! (from a file or an earlier edit) stays as it was through an unrelated edit, such as renaming a defined name it does not use. * paste: a cut moves on its sheet as it is named now A cut whose source sheet is renamed before the paste rebased its moved rules, and the references to its cells, against the name the clipboard saw, which no longer exists. A cut in the same workbook now uses the live sheet name. * formulas: renaming a defined name leaves LET and LAMBDA locals alone The rename walk now tracks the locals in scope: a LET or LAMBDA local of the old name is not the defined name and keeps its name, and a rename that a local of the new name would capture is refused and changes nothing. It is the one walk for cells, names, rules and Python cells. * formulas: a name rename renames calls to it and is refused where a sheet name would take it A call to a defined LAMBDA by name (`FnOld(4)`) now follows a rename of the name; a called LET or LAMBDA local of the old name stays as it is. A workbook name renamed to a name a sheet defines for itself would be read as that sheet's name there, so that rename is refused. * paste: a cut is refused as Paste Link or into filtered-out rows before its source is cleared Paste Link would write links to the cells the cut empties, and a destination in rows the filter hides would skip every cell the cut writes; both lost the cut cells. * sheets: a pending cut ends when a sheet edit puts another sheet in its place A cut names its sheet by its place among the tabs, so after inserting, deleting or moving a sheet before it, a paste took cells and rules from whichever sheet had that place. The cut now ends when its place holds another sheet (or none); a cut whose sheet kept its place stays, and a copy reads its own snapshot and stays. * model: a sheet-level name's references are rewritten on its own sheet Unqualified references in a sheet-level name are read on its scope sheet, so rewrite_references now hosts them there: inserting a row above one moves it, as it moves a cell formula on that sheet. Workbook-level names keep NAME_HOST. * model: a PivotTable source that names a table is left out of a name's rewrite A bare source that is a table's name reads the table before a defined name of that name, so renaming the defined name no longer moves the PivotTable off its table. * sheet: a rule follows its top-left cell through a partial cell delete or insert Deleting cells in only the first column of a rule's range keeps the range's size, so it was treated as moved whole and its formulas stayed written for the deleted cell (=A1>0 became =#REF!>0). When the cell the shift puts at the top-left was one of the rule's own cells, the formulas now follow it. * sheet.moveColumns: a moved column's part of a rule reads what the column read The moved part was taken after the columns were made room for, when the rule's formula (written for its top-left) no longer said what the moved cells read: a rule on B1:D1 testing =A1>0, with D moved before B, left the moved cell testing old B instead of old C. The parts are now taken from the sheet before the insert and follow it as the cells' formulas do. move_cut_rules' placing half is place_moved_rules, shared. * tests: the broken-chart-source test rewrites the chart it checks A series now reads the renamed name, so the rename takes the branch that rewrites the chart, and the test checks the series changed while the broken source stayed. * Revert "sheets: a pending cut ends when a sheet edit puts another sheet in its place" This reverts commit |
||
|
|
572bec289b |
engine: work limits for Advanced Filter, Remove Duplicates, filters, AutoFit, macro footprints; range sizes saturate (#3295)
* engine: bound Advanced Filter, Remove Duplicates, AutoFilter, Circle Invalid Data; one-pass AutoFit; saturating range dimensions * address review: AutoFit scans each run of adjacent selected columns separately * address review: report a truncated circle-invalid scan, no spill scan for plain cells in Replace, one pass for many AutoFit runs * address review: warn in the app when Circle Invalid Data stopped early; Replace test requires success * address review: the scan note joins an open-time notice; say cell visits |
||
|
|
21b64df0fe |
Paste of a whole-column or whole-row copy no longer aborts the app (#2018)
* Paste: whole-column paste and validation without per-cell blowup edit.paste of a whole-column or whole-row copy walked every cell of the copied block (up to the whole sheet) and, for each one, re-cut every validation rule and pushed a one-cell rule. Over a 2M-cell block that is quadratic and the fuzz soak aborted on 34-68 GB allocations. - Paste visits only cells that hold something in the source or the destination; blank onto blank changes nothing (and with an operation stays blank, as in Excel, instead of becoming 0). - Validation pastes as ranges: the pasted rectangle is cut once out of the destination's rules and each source rule comes along as one rule over its translated parts (Skip Blanks or not, as Excel does). - Whole columns and rows paste whole, so destination content further down the columns is replaced, as in Excel. - A paste that does not fit on the sheet is refused, as Excel does, instead of pasting part of the block (whole columns below row 1, whole rows right of column A, a whole column transposed, a block at XFD). - Paste Link, the one paste that writes every cell, is capped at 1,048,576 cells; tiled validation at 100,000 ranges. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Paste: visit destination cells once per paste, add link, transpose and tiling tests Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Paste: visit link-only cells so a cut keeps their hyperlink * Paste validation: Skip Blanks keeps the destination rule under a blank source cell with no rule * Paste validation: Skip Blanks collects clearing cuts only when a rule is under the paste, merges them into runs, and limits only generated areas * Paste validation: annotate the clearing cut list * Qualify paste validation context type * Fix paste-special clippy warnings * engine: batch validation range cuts * Fix range type inference * Annotate validation range index type * Avoid shadowing test session helper * Keep validation rows after the final cut --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
342f4b401d |
Check list validation against the list before the entry
A source that takes in the cell being checked (=$A1:$A2 on A2:A3 is A2:A3 at A3) listed the value being typed, so any new value passed. The list is now read from the workbook as it was before the entry, as in Excel. |
||
|
|
179664610c |
Read relative list validation sources from the cell being checked
A list source such as =$B1:$B2 is written for the rule's top-left cell. list_items evaluated it there for every cell, so the dropdown and the check showed and accepted the top-left cell's items everywhere. It now takes the cell and shifts the source to it, as Excel does. |
||
|
|
fb6dc688bc |
Rewrite rule formulas for the new top-left cell when cells are removed from a rule
Clearing validation from cells (or setting a new rule, or pasting a validation over them) and Clear Rules on selected cells shrink a rule's areas. When that removes the rule's top-left cell, the relative formulas were left written for the old cell, so the cells left checked other cells: clearing A1 off a custom `A1>10` on A1:A9 made A2 check A1. Rewrite the relative references of validation formulas, and of conditional format expressions and comparison values, for the new top-left cell. Absolute references and literal lists stay as they are. |
||
|
|
adcb66697c |
Data validation and conditional formats: anchor relative formulas on the top-left cell of all areas (#3152)
Excel writes the relative formulas of a multi-area rule for the top-left cell of the whole sqref (lowest row, lowest column), whatever order the areas are listed in. GridCraft anchored them on the first area listed, so a validation on `H62:H68 H26:H27 H93:H95` with `MOD($H26,$F26)=0` checked row 26 - 36 at H26 and refused valid input. Add `RangeRef::top_left` and use it in validation checks, list sources, pasting a validation, conditional format lookups and the formulas the xlsx writer generates for text, blank and error rules. |
||
|
|
9717ccbac1 | Refactor engine for strict Clippy checks | ||
|
|
0e2335531d | refactor(engine): move cmd/data.rs items to cmd/data/ |