Repository navigation
fix(edit): Ctrl+Enter gives each cell the number format typing gives it (#1919) - #1920
Merged
Merged
Conversation
range.fill parsed the input once at the active cell, then put back the old style of every target that already held a cell, so 5%, $5, 3/4/2026 or =DATE(...) lost their automatic format there (0.05, 5, 46085), and empty targets took the active cell's style. Each target now gets what input_to_cell gives for it (parsed once per distinct style), as typing does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Merged — thank you @vedran-dobos for the contribution! |
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.
Fixes #1919.
range.fill(Ctrl+Enter) parsed the input once at the active cell, then put each target cell’s oldstyle back when it already held a cell, so
5%,$5,3/4/2026or=DATE(…)lost theirautomatic format there (0.05, 5, 46085). Empty targets took the active cell’s style instead of
their own. Now each target gets what
input_to_cellgives for that cell, which is what typing theinput there gives.
What changed
cmd/edit.rsrange_fill: the input goes throughinput_to_cellfor each targetcell, so a General cell gets the automatic format, a cell with its own format (or a formatted row
or column) keeps it, and a Text cell gets the input as text, as with
cell.set. The result onlydepends on the cell’s style, so it’s parsed once per distinct style, not per cell; relative
formulas are still shifted from the active cell as before.
input_to_cellalready starts from the cell’s ownstyle).
Tests
crates/engine/tests/range_fill_formats.rs:filled_cells_that_already_hold_a_value_get_the_automatic_format:5%,$5,3/4/2026,1:30 PM,1.5E+3over A1:A2 with A2 holding 1; both cells must match whatcell.setgives ina fresh cell (text, value, format). Fails on
main(5%in A2 shows 0.05).filled_cells_with_their_own_format_keep_it: a0.000cell, an empty cell in a0.00columnand a Text row keep their format (and the Text cells get text). Fails on
main(the emptycolumn-formatted cell takes the active cell’s
0%).filled_formulas_still_shift_and_get_their_date_format:=DATE(2026,3,ROW())getsm/d/yyyyin a cell that held a value, and
=C1*2still shifts to=C2*2. Fails onmain(General).a_fill_undoes_in_one_step: guard, passes onmaintoo.Checks:
cargo xtask cigreen onmain66ce6be + this commit (fmt, clippy, tests, assets, layers,wasm, parity, keytips; 1622 tests, 0 failed).
Docs
docs/ui-parity.md: timestamp line and revision history.Overlap
skipcheck at the top of the sameloop; whichever merges second has a small textual conflict, and the two changes combine.
regionargument to theinput_to_cellcall this PRmoves into the loop.
Question for the maintainers
5%stays the text “5%”), astyping there does; before, it got the number 0.05 shown in the Text format. Is that the behaviour
you want for Ctrl+Enter?
Tried in a real window
Windows 11: type
1in A2, select A1:A2, type5%and press Ctrl+Enter. Both cells show5%, as in Excel (on
mainA2 shows 0.05).Unverified
🤖 Generated with Claude Code
Summary by CodeRabbit