Skip to content

Tables: typing in the header row renames the column; Go To a table selects its data - #149

Merged
h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
nihilist-narwhal:fix-table-header-edits
Oct 10, 2026
Merged

h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
nihilist-narwhal:fix-table-header-edits

Conversation

@nihilist-narwhal

Copy link
Copy Markdown
Contributor

Editing a table's header cell changed only the cell. The column kept its old name, so after typing zz over header a, =SUM(Table1[a]) still worked and the header read zz. Saving then wrote the old names back into the header row, so the edit was gone after reopening:

gridcraft-cli run --cmd 'range.setValues={"range":"A1","values":[["a","b","c"],[1,2,3]]}' \
  --cmd 'insert.table={"range":"A1:C2","header":true}' \
  --cmd 'cell.set={"cell":"A1","input":"zz"}' --cmd 'edit.clearContents={"range":"B1"}' --out t.xlsx
gridcraft-cli cat t.xlsx --range A1:C1   # a  b  c

As in Excel, the column now takes the new header. An emptied header becomes ColumnN and a repeated one gets a number (a2), written back into the cell; a number typed there is stored as text; and structured references follow the new name (=SUM(Table1[zz]), including [@col] inside the table). The check runs after every edit (cmd::edit) and looks only at edited header cells (every header cell after a structural edit, which can shift other cells into a header row), so sheets without tables pay nothing.

Second commit: Go To (and the Name Box) with a table's name selected the whole table, header and totals included. In Excel a table's name stands for its data rows, as in formulas (=SUM(Table1) adds only the data), so edit.goTo {"reference":"Table1"} now selects A2:B3 for a table on A1:B3. (Table1[col] and Table1[#All] still aren't accepted by Go To.)

  • New tests tables::tests::editing_a_header_renames_the_column and go_to_a_table_selects_its_data fail before their changes.
  • fmt, clippy (apart from the existing date.rs lint) and the engine tests pass.

Editing a table's header cell changed only the cell: the column kept its
old name, so =SUM(Table1[a]) still worked after the header read "zz",
and saving wrote the old names back into the header row, undoing the
edit on reopening. As in Excel, the column now takes the new header;
an emptied header becomes ColumnN and a repeated one gets a number
("a2"), written back into the cell, and structured references follow
the new name.
Go To (and the Name Box) with a table's name selected the whole table,
header and totals rows included. In Excel a table's name stands for its
data rows, as in formulas (=SUM(Table1) adds only the data).
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 92fb7cd into storytold:main Oct 10, 2026
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 10, 2026
… after merging #149

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

echelon commented Oct 10, 2026

Copy link
Copy Markdown
Member

Landed — thank you for the contribution! Header renames following through to structured references is excellent parity work.

If you haven't already, please come join us on Discord: https://discord.gg/artcraft

quantmind-br added a commit to quantmind-br/gridcraft that referenced this pull request Oct 10, 2026
Conflicts resolved by keeping both intents:
- criteria/core: storytold#57's 15-significant-digit compare_numbers next to M12's
  locale-aware criteria parsing; MIN takes storytold#159's zero-argument arity with
  the regional number coercion.
- calc: storytold#148's range-ending-in-a-function precedents next to the unified
  is_special.
- csv: storytold#127's "a candidate must appear on every line" rule applies to the
  regional sniffer; when none does, the region's list separator wins.
- formula bar: storytold#156's legacy array braces around the localized formula.
- data/mcp tests: both sides' additions kept.

Follow-ups for the merged code:
- table.resize: a repeated header is numbered as insert.table does
  (`Column2` -> `Column22`) and new or blank headers are written into the
  header cells, so storytold#149's header sync (header cell == column name) no
  longer renames resized columns positionally.
- formula bar: the cell-picture text from storytold#105 goes through Fluent in all
  12 languages.
quantmind-br added a commit to quantmind-br/gridcraft that referenced this pull request Oct 10, 2026
…rmats)

Interface, formula language and regional format work as in Excel: function
names, booleans, errors and format-code letters follow the formula language
(the interface language by default, or en-US); separators, dates, months and
currency follow the regional format. Workbooks, XLSX, the journal and
programmatic params stay canonical (English names, `,` arguments, `.`
decimal), so a file opens the same in every language. Local text only
crosses the engine boundary as `*Local` fields.

Languages: en-US, pt-BR, pt-PT, es-ES, fr-FR, de-DE, it-IT, ru-RU, ja-JP,
ko-KR, zh-CN, zh-TW (Japanese, Korean and Chinese keep English function
names, as Excel does).

- locale (new, L0): language and region data in TOML, validated by build.rs
  (missing keys, duplicate local names, colliding separators, canonical en-US),
  CLDR-style negotiation of OS and browser tags.
- formula: tokenize/parse/print per dialect; one function catalog with file
  prefixes replaces the four hand-kept lists (_xlfn., _xludf. for canonical
  names typed in a localized dialect, _xlpm. for LET/LAMBDA parameters).
  In ru-RU `:` separates array-constant rows: inside braces a number followed
  by `:` is a number, since array constants hold no references.
- core, numfmt, functions, calc: regional input parsing and text-to-number
  coercion, localized number-format codes and display, TEXT/FIXED/DOLLAR,
  VALUE/DATEVALUE/NUMBERVALUE, criteria, CELL/INFO keywords, DBCS *B
  functions.
- l10n (new, L4): Fluent messages for all 12 languages, same keys and
  arguments as en-US; `cargo xtask locales` reports coverage and runs in ci.
- engine: locale prefs, app.setLocale / app.getInternational /
  app.languages, file.options (catalog: 259 / 290), inputLocal /
  formulaLocal / valueLocal / numberFormatLocal / refersToLocal, stable
  EngineError codes, regional CSV, app-created content in the interface
  language.
- ui-egui and apps: translated UI and native menus, local formula editing
  with autocomplete and argument hints, Options > Language (live switch),
  localized shortcuts where Excel localizes them, IME, CJK font fallback
  (font bytes validated before egui sees them), system locale detection,
  localStorage prefs on the web, CLI --locale, MCP local params.

Built on upstream work:
- Interface languages (storytold#31, storytold#82, storytold#104): the hand-written table in
  crates/ui-egui/src/i18n.rs is folded into the Fluent catalog; every
  upstream language stays, Russian is the 12th (function names voted from
  Microsoft's ru-RU pages, checked against independent tables, with aliases
  such as УСЛОВИЯ and ЕСЛИНД). The View-tab picker runs app.language.set
  and shares the preference with Options > Language; ui.json language codes
  migrate once to prefs.json unless they are what old builds detected from
  the system. Text box editing (storytold#84) and key tips (storytold#43) keep working, with
  translated captions; key tip letters stay English in every language.
- Spanish formulas (storytold#98) are folded into this design: names follow the
  interface language and separators the region, so FormulaLocale,
  UiState.language and docs/formula-input.md are superseded. Its
  name-precedence rule is kept and generalized: defined names, table names
  and LET/LAMBDA bindings win over localized function names and booleans
  (parse_local_with/print_local_with, Workbook::knows_name) in cell input,
  *Local params, display, find/replace, CF, validation, names,
  FORMULATEXT and INDIRECT. A built-in whose local spelling a name took is
  written with its file prefix (_xlfn.SUM, _xlfn.FALSE()). The journal
  re-reads *Local params against the workbook as the command found it.
  storytold#98's UI tests are ported.
- Progress docs (storytold#189): localization re-measured (~10% -> ~50% ready).
- storytold#57/storytold#159: compare_numbers and MIN() with no arguments use the regional
  coercion. storytold#148: precedents of ranges ending in a function. storytold#127: the
  every-line delimiter rule applies to the regional CSV sniffer, whose
  fallback is the region's list separator. storytold#156: legacy array braces around
  the localized formula. storytold#149: table.resize writes the names it chooses into
  the header cells and numbers repeated headers like insert.table. storytold#105:
  cell-picture strings in all 12 languages.
- Restored upstream behaviour: imported ODS/XLSB files are titled
  "<name> (imported).xlsx"; the import message shows 5 warnings plus a count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quantmind-br added a commit to quantmind-br/gridcraft that referenced this pull request Oct 11, 2026
…rmats)

Interface, formula language and regional format work as in Excel: function
names, booleans, errors and format-code letters follow the formula language
(the interface language by default, or en-US); separators, dates, months and
currency follow the regional format. Workbooks, XLSX, the journal and
programmatic params stay canonical (English names, `,` arguments, `.`
decimal), so a file opens the same in every language. Local text only
crosses the engine boundary as `*Local` fields.

Languages: en-US, pt-BR, pt-PT, es-ES, fr-FR, de-DE, it-IT, ru-RU, ja-JP,
ko-KR, zh-CN, zh-TW (Japanese, Korean and Chinese keep English function
names, as Excel does).

- locale (new, L0): language and region data in TOML, validated by build.rs
  (missing keys, duplicate local names, colliding separators, canonical en-US),
  CLDR-style negotiation of OS and browser tags.
- formula: tokenize/parse/print per dialect; one function catalog with file
  prefixes replaces the four hand-kept lists (_xlfn., _xludf. for canonical
  names typed in a localized dialect, _xlpm. for LET/LAMBDA parameters).
  In ru-RU `:` separates array-constant rows: inside braces a number followed
  by `:` is a number, since array constants hold no references.
- core, numfmt, functions, calc: regional input parsing and text-to-number
  coercion, localized number-format codes and display, TEXT/FIXED/DOLLAR,
  VALUE/DATEVALUE/NUMBERVALUE, criteria, CELL/INFO keywords, DBCS *B
  functions.
- l10n (new, L4): Fluent messages for all 12 languages, same keys and
  arguments as en-US; `cargo xtask locales` reports coverage and runs in ci.
- engine: locale prefs, app.setLocale / app.getInternational /
  app.languages, file.options (catalog: 259 / 290), inputLocal /
  formulaLocal / valueLocal / numberFormatLocal / refersToLocal, stable
  EngineError codes, regional CSV, app-created content in the interface
  language.
- ui-egui and apps: translated UI and native menus, local formula editing
  with autocomplete and argument hints, Options > Language (live switch),
  localized shortcuts where Excel localizes them, IME, CJK font fallback
  (font bytes validated before egui sees them), system locale detection,
  localStorage prefs on the web, CLI --locale, MCP local params.

Built on upstream work:
- Interface languages (storytold#31, storytold#82, storytold#104): the hand-written table in
  crates/ui-egui/src/i18n.rs is folded into the Fluent catalog; every
  upstream language stays, Russian is the 12th (function names voted from
  Microsoft's ru-RU pages, checked against independent tables, with aliases
  such as УСЛОВИЯ and ЕСЛИНД). The View-tab picker runs app.language.set
  and shares the preference with Options > Language; ui.json language codes
  migrate once to prefs.json unless they are what old builds detected from
  the system. Text box editing (storytold#84) and key tips (storytold#43) keep working, with
  translated captions; key tip letters stay English in every language.
- Spanish formulas (storytold#98) are folded into this design: names follow the
  interface language and separators the region, so FormulaLocale,
  UiState.language and docs/formula-input.md are superseded. Its
  name-precedence rule is kept and generalized: defined names, table names
  and LET/LAMBDA bindings win over localized function names and booleans
  (parse_local_with/print_local_with, Workbook::knows_name) in cell input,
  *Local params, display, find/replace, CF, validation, names,
  FORMULATEXT and INDIRECT. A built-in whose local spelling a name took is
  written with its file prefix (_xlfn.SUM, _xlfn.FALSE()). The journal
  re-reads *Local params against the workbook as the command found it.
  storytold#98's UI tests are ported.
- Progress docs (storytold#189): localization re-measured (~10% -> ~50% ready).
- storytold#57/storytold#159: compare_numbers and MIN() with no arguments use the regional
  coercion. storytold#148: precedents of ranges ending in a function. storytold#127: the
  every-line delimiter rule applies to the regional CSV sniffer, whose
  fallback is the region's list separator. storytold#156: legacy array braces around
  the localized formula. storytold#149: table.resize writes the names it chooses into
  the header cells and numbers repeated headers like insert.table. storytold#105:
  cell-picture strings in all 12 languages.
- Restored upstream behaviour: imported ODS/XLSB files are titled
  "<name> (imported).xlsx"; the import message shows 5 warnings plus a count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quantmind-br added a commit to quantmind-br/gridcraft that referenced this pull request Oct 11, 2026
…rmats)

Interface, formula language and regional format work as in Excel: function
names, booleans, errors and format-code letters follow the formula language
(the interface language by default, or en-US); separators, dates, months and
currency follow the regional format. Workbooks, XLSX, the journal and
programmatic params stay canonical (English names, `,` arguments, `.`
decimal), so a file opens the same in every language. Local text only
crosses the engine boundary as `*Local` fields.

Languages: en-US, pt-BR, pt-PT, es-ES, fr-FR, de-DE, it-IT, ru-RU, ja-JP,
ko-KR, zh-CN, zh-TW (Japanese, Korean and Chinese keep English function
names, as Excel does).

- locale (new, L0): language and region data in TOML, validated by build.rs
  (missing keys, duplicate local names, colliding separators, canonical en-US),
  CLDR-style negotiation of OS and browser tags. Only en-US must list every
  function: one another language doesn't list yet keeps its English spelling
  there, so adding a worksheet function needs English data only.
- formula: tokenize/parse/print per dialect; one function catalog with file
  prefixes replaces the four hand-kept lists (_xlfn., _xludf. for canonical
  names typed in a localized dialect, _xlpm. for LET/LAMBDA parameters).
  In ru-RU `:` separates array-constant rows: inside braces a number followed
  by `:` is a number, since array constants hold no references.
- core, numfmt, functions, calc: regional input parsing and text-to-number
  coercion, localized number-format codes and display, TEXT/FIXED/DOLLAR,
  VALUE/DATEVALUE/NUMBERVALUE, criteria, CELL/INFO keywords, DBCS *B
  functions.
- l10n (new, L4): Fluent messages for all 12 languages, same keys and
  arguments as en-US (function descriptions may fall back to en-US);
  `cargo xtask locales` reports coverage, lists untranslated function names
  and descriptions as warnings, and runs in ci.
- engine: locale prefs, app.setLocale / app.getInternational /
  app.languages, file.options (catalog: 259 / 290), inputLocal /
  formulaLocal / valueLocal / numberFormatLocal / refersToLocal, stable
  EngineError codes, regional CSV, app-created content in the interface
  language.
- ui-egui and apps: translated UI and native menus, local formula editing
  with autocomplete and argument hints, Options > Language (live switch),
  localized shortcuts where Excel localizes them, IME, CJK font fallback
  (font bytes validated before egui sees them), system locale detection,
  localStorage prefs on the web, CLI --locale, MCP local params.

Built on upstream work:
- Interface languages (storytold#31, storytold#82, storytold#104): the hand-written table in
  crates/ui-egui/src/i18n.rs is folded into the Fluent catalog; every
  upstream language stays, Russian is the 12th (function names voted from
  Microsoft's ru-RU pages, checked against independent tables, with aliases
  such as УСЛОВИЯ and ЕСЛИНД). The View-tab picker runs app.language.set
  and shares the preference with Options > Language; ui.json language codes
  migrate once to prefs.json unless they are what old builds detected from
  the system. Text box editing (storytold#84) and key tips (storytold#43) keep working, with
  translated captions; key tip letters stay English in every language.
- Spanish formulas (storytold#98) are folded into this design: names follow the
  interface language and separators the region, so FormulaLocale,
  UiState.language and docs/formula-input.md are superseded. Its
  name-precedence rule is kept and generalized: defined names, table names
  and LET/LAMBDA bindings win over localized function names and booleans
  (parse_local_with/print_local_with, Workbook::knows_name) in cell input,
  *Local params, display, find/replace, CF, validation, names,
  FORMULATEXT and INDIRECT. A built-in whose local spelling a name took is
  written with its file prefix (_xlfn.SUM, _xlfn.FALSE()). The journal
  re-reads *Local params against the workbook as the command found it.
  storytold#98's UI tests are ported.
- Progress docs (storytold#189): localization re-measured (~10% -> ~50% ready).
- storytold#57/storytold#159: compare_numbers and MIN() with no arguments use the regional
  coercion. storytold#148: precedents of ranges ending in a function. storytold#127: the
  every-line delimiter rule applies to the regional CSV sniffer, whose
  fallback is the region's list separator. storytold#156: legacy array braces around
  the localized formula. storytold#149: table.resize writes the names it chooses into
  the header cells and numbers repeated headers like insert.table. storytold#105:
  cell-picture strings in all 12 languages.
- Restored upstream behaviour: imported ODS/XLSB files are titled
  "<name> (imported).xlsx"; the import message shows 5 warnings plus a count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants