Skip to content

Prevent inspector float edits from collapsing/rounding literal values - #65

Merged
matt-edmondson merged 2 commits into
mainfrom
copilot/edit-floating-point-literal
Sep 13, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
copilot/edit-floating-point-literal

Conversation

Copilot AI commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Editing AstFieldKind.Fraction fields in the inspector was using a fixed-format double display path that could truncate precision and collapse small magnitudes (e.g. 1e-9) toward 0 on commit. This change makes the inspector’s double formatting round-trip-safe for source literals and locks behavior with a focused regression test.

  • Inspector numeric format (behavior fix)

    • AstGraphEditor now configures its property grid with a round-trip-oriented double format (%.17g) so displayed/parsed values preserve literal magnitude and precision across edits.
    • This addresses both tiny scientific-notation values and high-precision literals touched in the UI.
  • Regression coverage (UI inspector path)

    • Added an inspector panel test for LiteralExpression<double> with a small magnitude (1e-9) that verifies:
      • value remains unchanged after draw/selection (no silent mutation),
      • value is preserved through an edit commit round-trip.
private static readonly ImGuiWidgets.PropertyGridOptions InspectorGridOptions = new()
{
	LabelColumnWeight = 0.95f,
	DoubleFormat = "%.17g",
};

Co-authored-by: matt-edmondson <19528727+matt-edmondson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix truncation of floating-point literals in inspector Prevent inspector float edits from collapsing/rounding literal values Sep 13, 2026
@matt-edmondson
matt-edmondson marked this pull request as ready for review September 13, 2026 12:18
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 438c440 into main Sep 13, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the copilot/edit-floating-point-literal branch September 13, 2026 12:28
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.

Editing a floating-point literal in the inspector truncates it to six decimal places

2 participants