Skip to content

Allow editing and selecting text inside worksheet text boxes - #84

Merged
h-a-n-a-s-h-i merged 3 commits into
storytold:mainfrom
harrisonoconnorhover:codex/text-box-editing
Oct 10, 2026
Merged

h-a-n-a-s-h-i merged 3 commits into
storytold:mainfrom
harrisonoconnorhover:codex/text-box-editing

Conversation

@harrisonoconnorhover

Copy link
Copy Markdown
Contributor

Fixes #56.

Text boxes were painted and movable, but had no editor. Double-clicking a text box now opens an inline multiline editor with mouse text selection, copy/cut/paste and local text undo. Clicking outside commits one undoable shape.setText command; Escape discards the draft. Existing and XLSX-imported text boxes use the same path.

Save/Save As and sheet/workbook switches commit the draft to its original text box before acting. Worksheet input stays separate, and border dragging/resizing still works. Native macOS Edit menu actions are routed to the focused text editor.

Validation:

  • Three engine regression groups fail before the command exists and pass after it, including undo/redo, empty/multiline text, target validation and XLSX import/edit/save/reopen.
  • Three UI groups exercise real pointer/key events, selection/clipboard, cancel, move/resize, saving and context switches. The baseline fails editing/copy and saving the new text; the completed tests pass.
  • All 343 workspace tests passed; after the final offscreen-scrolling and read-only-query guards, the three text-box groups and seven existing interaction tests passed again. Native build, formatting, WASM, asset attribution, layering and command parity checks pass. Offscreen WGPU rendering was visually inspected.
  • Full CI still stops at the existing core/date.rs:100 Clippy finding. Scoped lint checks report existing findings in engine/cmd/file.rs, ui-egui/formula_bar.rs and unchanged portions of ui-egui/grid.rs; no suppressions added.

Native desktop interaction could not be qualified in this session: the test window did not present reliably. The interaction and visual evidence above comes from the offscreen UI harness.

harrisonoconnorhover and others added 3 commits October 9, 2026 17:47
# Conflicts:
#	apps/gridcraft/src/native_menu.rs
#	crates/engine/src/tests.rs
shape.setText refuses edits on a protected sheet (drawing objects are
locked; there is no edit-objects allowance yet) and text longer than
32,767 characters, like a cell. The editor doesn't open on a protected
sheet and its TextEdit carries the same character limit. Tests for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit e20a7b4 into storytold:main Oct 10, 2026
@echelon

echelon commented Oct 10, 2026

Copy link
Copy Markdown
Member

Merged into main — thank you! Review fix-ups pushed to your branch: shape.setText now refuses edits on a protected sheet and caps text at 32,767 characters (like a cell), the inline editor won't open on a protected sheet and has the same char limit, with engine and UI tests.

If you haven't already, please come join us on Discord: https://discord.gg/artcraft — we'd love to have you around.

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.

Text Box - unable to edit or select contents

3 participants