Repository navigation
R0: clippy refuses the en-US entry points; the 23 callers it found read the workbook region - #4002
Draft
danilo-aguiar-br wants to merge 47 commits into
Draft
danilo-aguiar-br wants to merge 47 commits into
danilo-aguiar-br wants to merge 47 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
crates/numfmt wrote '.' and ',' as constants, so the Region data merged in storytold#3048 could not reach a cell. This threads a &Region through the formatter: - format_value_in is the new entry point; format_value keeps its signature and delegates with EN_US, so current callers are unchanged. - render_number, render_fraction and the General path take the decimal point and the thousands separator from the region. - TEXT() stays en-US, because a worksheet function locale is its own decision. Refs storytold#967.
Excel stores the canonical '.' decimal and ',' grouping, but people type the code their region uses: #.##0,00 in it-IT, #.##0,00 in pt-BR. NumberFormat::parse_in translates a hand-typed code to the canonical one before parsing, leaving quoted text, bracket tags and escaped characters alone. The test covers the three paths in one place: format_value stays en-US, format_value_in shows the region, and parse_in reads the typed code with that region. It fails without the change, because neither parse_in nor format_value_in exists.
The Format Cells dialog needs the same translation in both directions: it shows a stored code with the region's separators and reads the edited code back. regional_code is public for that, and its own inverse is what makes one call serve both.
regional_code only swapped . and , so a region that groups with a non-breaking space (fr-FR, pt-PT, ru-RU, cs-CZ) showed a code it does not use and typed one it could not read back as grouping. Translate region.group as well, in both directions, because the translation is no longer its own inverse when the group is not ,.
A separator is one only between two digit placeholders, so the . of dd.mm.yyyy and of hh:mm:ss.000 stays a date separator instead of becoming a comma in a region that groups with it.
A grouping separator right after the digits scales the value by 1,000, and it has no digit after it, so regional_code and canonical_code left it in the other region's character: 0.0, stayed with a canonical comma in Italy and NumberFormat::parse_in("0,0.", it) kept a trailing dot the parser ignores. remap_separators now tracks that trailing run and converts it in both directions, including a run of them, so 0.0, shows as 0,0. and 0.0,, as 0,0..
- `cell.set` takes a JSON number in the workbook's region, so `3.141` stays 3.141 in pt-BR instead of becoming 3141. - A ribbon number format stores its canonical code once: `set_fmt` no longer canonicalizes a code it already converted, and the Format Cells dialog sends what the user sees. - Criteria read numbers with the workbook region: `SUMIF`, `COUNTIF`, the database functions and the autofilter. - Charts format their numbers with the workbook region through `render_in`; `render` keeps the en-US reading. - Undo and redo keep the current region through `DocState::adopt_region`, which also leaves a clean workbook clean when the region changes.
Saving a workbook that was opened with a password as .xlsx now encrypts it again with that password through craft_offcrypto::encrypt (Agile, AES-256, SHA-512). The password stays in memory only, in DocState, and Debug redacts it. A decrypted workbook still has no path, so Save asks where to write and never replaces the original.
# Conflicts: # crates/core/src/parse.rs # crates/engine/src/tests.rs
# Conflicts: # crates/engine/src/tests.rs
# Conflicts: # apps/gridcraft-cli/src/main.rs # crates/ui-egui/tests/it/main.rs
danilo-aguiar-br
force-pushed
the
region/r-root-cause
branch
from
November 13, 2026 11:20
a7f1866 to
f35edef
Compare
…guage The Conditional Formatting menu, More Borders and the title bar's More commands and Share menus built their buttons from English text without the translation every other ribbon menu uses, so they stayed English in Portuguese. They now go through the language table, with the Portuguese names added.
…ed as the engine's With nothing copied in GridCraft, Paste Special refused with "the clipboard is empty" even when another program, or a GridCraft window running as another process, had copied text. It now pastes that text, read in the workbook region, as Excel's Text paste format does. A formula the cell editor can't read is reported as "There's a problem with this formula: ...", translated, as cell.set reports it, instead of the parser's bare token.
…ion's decimal The cell editor rewrote a number typed with the formula language's decimal separator to a dot. Since typed input is read in the workbook region, a pt-BR or es-ES workbook then read 1,5 as the date 1 May. The number now goes on with the region's own decimal separator.
…rder The numpad's decimal key types the region's decimal separator (a comma in pt-BR), whatever the keyboard layout, as a US layout sends a dot from it. Keystrokes that arrive in one frame keep their order: text after Enter, Tab, Esc or an arrow waits for the next frame instead of landing in the cell being committed, and with no cell being edited the keys after the first character are no longer dropped.
# Conflicts: # crates/ui-egui/src/formula_locale.rs
danilo-aguiar-br
force-pushed
the
region/r-root-cause
branch
from
November 14, 2026 02:06
f35edef to
3e99c86
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on the region series (#3718, #3989, #3990, #3992, #3993, #3994, #3997, #3998, #3999, #4000). Draft until they land; review the last three commits,
R0,R2andR1.Root cause of the region bugs: every operation has a region-less entry point that hard-codes en-US (
parse_input,parse_number_text,format_value,text_function,format_general_fit,Value::to_number), and a caller that picks it by mistake gets no warning.clippy.tomlrefuses those entry points (disallowed-methods, each with a reason). Every remaining en-US use carries#[allow(clippy::disallowed_methods)] // en-US on purpose: <why>(file syntax, canonical formulas and API,NUMBERVALUE, tests).cargo xtask cialready runs clippy with-D warnings, so a forgotten region now fails the build.functions): argument helpers (num,numbers,int…) take the context and read text in the workbook's region, so in pt-BRABS("-1,5"),SUM("1,5";2),ROUND("2,345";"2"),DAY("15/03/2026")andAGGREGATE'skwork.calc,engine):CHOOSE/INDEX/OFFSET/TRIMRANGEpositions, typing-R$ 10(became a formula), validation and conditional-format thresholds from formula text, and Paste Special on numbers stored as text.en-US results are unchanged. Tests:
text_arguments_read_in_the_workbook_region,position_arguments_read_numeric_text_in_the_workbook_region,typing_validation_and_paste_special_read_numeric_text_in_the_workbook_region; each fails without the change.cargo clippy --workspace --all-targets -- -D warnings: exit 0.nextest --workspace: 3737 run, 3735 passed; the 2 failures are glyph tests that fail onmainwithoutẞ/ẻfonts.Note: date text in function arguments now also follows the workbook's date system (1904 workbooks read it in 1904).