Repository navigation
Format: Row Height and Column Width say pixels, and take points like Excel - #1085
Merged
aiongg merged 1 commit intoOct 22, 2026
Merged
Conversation
…Excel
home.rowHeight and home.columnWidth take pixels at 96 dpi, the model's unit
(header drags and the Row Height dialog send pixels), but their parameter docs
said points. An agent asking for a 30 pt row got `ht="22.5"` in the file, and
the range check accepted 500 while its message said "between 0 and 409 points".
- The params docs say pixels: `height: 20 (pixels) | points: 15`,
`width: 64 (pixels) | chars: 8.43`, and `{width: 64 (pixels)}` for
home.defaultWidth. Pixel values behave as before.
- home.rowHeight takes `points`, Excel's unit (Row Height dialog, `ht` in the
file), as home.columnWidth already takes `chars`.
- Range errors give the limit in the unit passed: 546 pixels (409.5 points),
409.5 points, 1800 pixels, 255 characters. `chars` is checked against 255,
Excel's limit and the widest column a file holds (it went to 256.4 through
the pixel limit).
- The model's size comments say pixels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Found while driving GridCraft 0.6.1 over MCP.
list_commandsdocumentshome.rowHeightasheight: 20 (points on screen)andhome.columnWidthaswidth: 64 (points) | chars: 8.43, but both values are pixels at 96 dpi, the model's unit. An agent that follows the docs, or Excel's habits, gets a 30 pt row saved asht="22.5". The range check disagrees with its own message too:height: 500is accepted (saved as 375 pt) whileheight: 600fails with "Row height must be between 0 and 409 points."Who sends what (why pixels stay the unit)
Before choosing, I checked every caller:
ui-egui/src/grid.rs)height/widthHeight: 22.50 (30 pixels))ui-egui/src/dialogs.rs)heightcharswidth(home.defaultWidth)height/widthpx_to_pton write,pt_to_pxon readSo the UI has no unit bug: every caller already sends pixels, and only the parameter docs and the error messages were wrong. Changing
heightto points would have broken the drags, the dialogs, the samples and the tests, so this keeps pixels and adds Excel's unit next to them.What changed
All in
crates/engine/src/cmd/format.rs, plus comments incrates/model.paramsdocs say pixels:height: 20 (pixels) | points: 15,width: 64 (pixels) | chars: 8.43, and{width: 64 (pixels)}forhome.defaultWidth. Pixel values behave as before.home.rowHeighttakespoints, Excel's unit (its Row Height dialog,Range.RowHeight,htin the file), converted aspt * 4 / 3. This mirrorscharsonhome.columnWidth. When both are given,heightwins, aswidthdoes overchars.height: "Row height must be between 0 and 546 pixels (409.5 points)." (same 546 px limit as before; the XLSX reader also caps rows at 409.5 pt)points: "Row height must be between 0 and 409.5 points."width: "Column width must be between 0 and 1800 pixels." (same limit as before)chars: "Column width must be between 0 and 255 characters."charsis now checked against 255, Excel's limit and the widest column a file can hold (the writer caps at 1790 px). Before, it went through the pixel limit, sochars: 256was accepted despite the message.LineInfo::size,Sheet::default_col_width/default_row_height,DEFAULT_COL_WIDTHandchars_to_pointssaid points; they now say pixels at 96 dpi.Verification (Linux x86_64, original baseline fc45b7f)
cargo test -p gridcraft-engine --lib tests::row_height_and_column_width_take_pixels_or_excel_units: sets row 1 withpoints: 30, row 2 withheight: 30, row 3 withpoints: 409.5, column A withchars: 8.43and B withwidth: 100. It checks the model sizes (40, 30, 546 px; 64, 100 px), the saved<row r="1" ht="30" …>,<row r="2" ht="22.5" …>and<row r="3" ht="409.5" …>, the four out-of-range messages, and the threeparamsdocs. It fails onmain(format.rs and the model comments stashed) withcalled Result::unwrap() on an Err value: BadParams { cmd: "home.rowHeight", msg: "missingheight" }and passes here.gridcraft-cli mcp, same calls on both builds:main(fc45b7f)list_commandshome.rowHeightheight: 20 (points on screen)height: 20 (pixels) | points: 15home.rowHeight {height: 30}ht="22.5"ht="22.5"(unchanged)home.rowHeight {height: 600}home.rowHeight {points: 30}heightht="30"home.rowHeight {points: 410}heighthome.columnWidth {width: 100},{chars: 20}width="14.28125",width="20.7109375"cargo fmt --all -- --check,cargo clippy -p gridcraft-model -p gridcraft-engine --all-targets -- -D warnings: cleancargo test -p gridcraft-model -p gridcraft-engine(lib andtests/): all pass (engine lib 230, model 14,tests/14)cargo test -p gridcraft-ui-egui(unchanged crate, but it calls these commands from drags, dialogs and tests): all pass (596 tests)Limits and questions
pointsis now a one-line change indialogs.rs; I left the UI alone since it is a UI choice, not a bug.home.defaultWidthhas nocharsyet; happy to add it here if you'd like.chars_to_points,points_to_charsandapprox_text_widthkeep their names although they work in pixels. Renaming them touches the UI crate and CELL("width") returns the Column Width dialog value, without the padding (#735) #753, so only the comment ofchars_to_pointschanges here.width, and saved as 255 characters anyway) opens the Column Width dialog on 256.x characters, and OK now gets the 255 message instead of passing.Independent verification against updated main (84acf62, 2026-10-13)
The independent review reran
cargo fmt --all -- --check,cargo clippy -p gridcraft-model -p gridcraft-engine --all-targets -- -D warningsandcargo test -p gridcraft-model -p gridcraft-engineon the branch and its clean merge with 84acf62; all exited 0. The added regression tests failed with production code from 84acf62 and passed on both branch and merged trees. These checks are separate from the historical fc45b7f measurements above.Conflicts
Against upstream/main at 84acf62, git merge-tree is clean. Among the 100 open PRs reviewed, #885 (my open PR for honoring the sheet parameter) conflicts in the home.rowHeight and home.columnWidth parameter documentation. Whichever lands second should retain both the sheet parameter and the pixel/point documentation. #870 and #480 merge cleanly. This check does not cover every older open PR.