Repository navigation
Formulas: F3 opens Paste Name, which inserts a defined name or pastes the list of names - #2410
Conversation
… the list of names formulas.pasteName lists the names the active sheet can use (workbook names and the sheet's own, without hidden names, in alphabetical order). With name it puts the name at the caret of the formula being edited, replacing selected text, or starts =Name; with list: true it writes each name and the text of what it refers to in two columns from the active cell. The Paste Name dialog opens from F3 when the workbook has names, from Use in Formula's new Paste Names… item and from Alt+M, S, P. While a dialog is open over the edit, the editor takes no keys. Use in Formula lists the same names, and formulas.useInFormula inserts at the caret instead of replacing the text being edited.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Name listing and Paste Names command crates/engine/src/cmd/formulas.rs |
Registers formulas.pasteName, lists visible workbook and active-sheet names, and supports writing names and references to two columns. Engine tests cover name filtering, output, and error cases. |
Dialog and caret insertion crates/engine/src/lib.rs, crates/engine/src/cmd/extra.rs, crates/ui-egui/src/dialogs.rs, crates/ui-egui/src/editor.rs, crates/ui-egui/src/formula_bar.rs, crates/ui-egui/src/lib.rs, crates/ui-egui/tests/it/paste_names.rs, crates/ui-egui/tests/it/main.rs |
The dialog supports name selection, confirmation, and Paste List. Insertion replaces selected text or starts editing with =<name>. The formula editor retains its selection while the dialog is open. |
Shortcut and ribbon entry points crates/ui-egui/src/keymap.rs, crates/ui-egui/src/keytips/*, crates/ui-egui/src/ribbon.rs, crates/ui-egui/tests/it/keytips_generated.rs, docs/ui-parity.md |
F3, the MSP keytip, and the Formulas ribbon open or invoke Paste Name. The keytip test and UI parity document reflect the updated behavior. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
actor User
participant PasteNameDialog
participant formulas.pasteName
participant SheetApp
participant dialogs.insert_name
participant EditState
User->>PasteNameDialog: Confirm selected name
PasteNameDialog->>formulas.pasteName: Submit name
formulas.pasteName->>SheetApp: Return UiRequest::InsertName
SheetApp->>dialogs.insert_name: Route name request
dialogs.insert_name->>EditState: Insert at caret when editing
Possibly related PRs
- storytold/gridcraft#465: Stores macro data in hidden workbook-scope defined names, which the Paste Name list excludes.
- storytold/gridcraft#2144: Uses hidden workbook-scope defined names for stash data and macro storage, which the Paste Name list excludes.
Suggested reviewers: marcoarnulfo
Merge Risk: 
Minimal · up to 3557b
-
No actionable issue remains in the Paste Name flow; it is ready to merge after normal checks.
Security architecture risk: 
Low · up to 3557b
-
The new workflow remains within the active workbook and uses existing protected-cell checks and reversible editing. No introduced security vulnerability was established. Remaining uncertainty concerns compatibility with other consumers and behavior outside the inspected workflow.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The inspected effects are bounded to a pending editor or the active workbook's active sheet. An explicit Paste List destination cannot name a different sheet, and destination bounds are checked before mutation. This trace does not establish cross-tenant, credential, or service-level exposure.
Trust Boundaries and Controls
- observed — Paste List retains centralized protected-cell enforcement: its transaction does not set protection_checked, so old and new cell contents are checked before the workbook is replaced. Committed editor insertion also passes through cell.set's locked-cell checks.
- inferred — The normal dialog restricts selection to listed names, but programmatic insertion accepts arbitrary name text. That is not a newly established security bypass: useInFormula already accepted arbitrary text at the base, and the new path still requires ordinary editor commit before worksheet evaluation.
Resilience and Maintainability Implications
- observed — Paste List closes the dialog after submission, including on command failure, but reports the error through the existing alert path. Transaction failure leaves the original workbook uncommitted, so retry does not resume a partially written list.
-
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 27.91% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 13 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
… refuses a name it doesn't list (#2410)
Summary
GridCraft had no Paste Name dialog: F3 did nothing, Alt+M, S, P was a reserved key tip, and Formulas › Use in Formula had no Paste Names… item. In Excel, F3 "displays the Paste Name dialog box. Available only if names have been defined in the workbook" (Keyboard shortcuts in Excel), and the dialog's Paste List button produces "two columns in the spreadsheet" holding the "range names and the cell references that each range holds" (Insert a named range into a formula in Excel).
Changes
formulas.pasteName(Formulas › Defined Names, F3). It returns the names the dialog lists: the workbook's names and the active sheet's own, without hidden names, in alphabetical order.{name}puts the name at the caret of the formula being edited, in place of selected text, or starts=Namein the active cell.{list: true, at?}writes each name and the text of what it refers to in two columns from the active cell as one undo step, and keeps the cells' formats. It returns an error when there are no names or the list does not fit on the sheet.ui.dialog.confirmruns the same command. Paste List is disabled while a cell is being edited.formulas.useInFormulanow inserts at the caret: it used to replace the text being edited with=Name, and the menu used to list hidden names and other sheets' names.keytips.json, MSP opens the dialog.generated.rsandtests/it/keytips_generated.rswere regenerated withcargo xtask keytips.docs/ui-parity.mdgets the F3 entries in the F-key rows, a new F3 row (the Mac column says "not checked"), the header's Last updated date and Change list, and a revision history row.The pages do not give the list's order, which names it leaves out, or what Paste List writes into the cells. GridCraft's own rules: the names are in alphabetical order, the list holds the workbook's names and the active sheet's own (a sheet name hides the workbook name it shares) and leaves out hidden names, and Paste List writes the refers-to column as text and keeps the cells' formats. Up and Down, double-click, and Paste List being disabled during an edit are GridCraft's own behavior too.
Tests
paste_names_lists_the_names_the_active_sheet_can_usechecks the order, that a sheet name hides the workbook name it shares, and that hidden names and other sheets' names are left out. Onmain,formulas.pasteNameis an unknown command.paste_names_and_use_in_formula_ask_the_ui_to_insert_the_namechecks that both commands sendInsertName.InsertNamedoes not exist onmain.paste_list_writes_each_name_and_what_it_refers_tochecks the two text columns, that one Undo removes them, andat. It fails onmain.paste_list_needs_names_and_roomchecks that Paste List returns an error when three names start on the second-to-last row, when they start in the last column, and when the workbook has no names. It fails onmain.editor::tests::a_pasted_name_replaces_the_selected_textchecks that the selection is replaced and a stale function suggestion is cleared. It does not compile onmain.tests/it/paste_names.rshas 7 egui_kittest tests: F3 with and without names, OK, Up/Down,ui.dialog.confirm, F3 in the cell editor with typing locked out, Cancel keeping the selected text selected, and Paste List. OnmainF3 opens no dialog, so all seven fail.Before the gate, these targeted checks were run:
cargo fmt --all -- --check,cargo clippy -p gridcraft-engine -p gridcraft-ui-egui --all-targets -- -D warnings,cargo test -p gridcraft-engine,cargo test -p gridcraft-ui-egui,cargo xtask keytips --check,cargo xtask assetsandcargo xtask layers.cargo test -p gridcraft-ui-eguihad one failure,header_autofit::table_filter_autofit_works_through_command_and_header_double_click, which also fails onmainat72c1d57on this machine.Checks
On Windows 11 (x86-64) with rustc 1.99.1, on top of
mainat72c1d57, with #2273 merged in:cargo xtask cipasses its 10 steps: 2,280 tests passed, 0 failed, 1 ignored.#2273 fixes
header_autofit::table_filter_autofit_works_through_command_and_header_double_click, which fails onmainat72c1d57on this machine without this branch. Without #2273,cargo xtask cistops at its test step on that test.git merge-treereports no conflicts withmainat72c1d57.Summary by CodeRabbit