Skip to content

Don't capitalize the word after a decimal point in sentence case - #1969

Merged
aiongg merged 1 commit into
storytold:mainfrom
Silvertree2010:fix/h11403-sentence-case-capitalizes-the-wo
Nov 8, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
Silvertree2010:fix/h11403-sentence-case-capitalizes-the-wo

Conversation

@Silvertree2010

@Silvertree2010 Silvertree2010 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Found while testing crates/model/src/edit.rs:~505 (change_case_parts, sentence branch) (no existing issue): Sentence case capitalizes the word after a decimal point.

Cause

In the sentence branch of change_case_parts, every '.', '!' or '?' started a new sentence. A '.' between two digits, as in '3.5' or '1.2', therefore capitalized the next word.

Fix

A '.' with an ASCII digit on each side no longer starts a new sentence. The check uses the characters of all runs, so it also works when the digits are split across run boundaries. Regular sentence ends such as 'HELLO. WORLD' behave as before.

Verified

  • Regression test edit::tests::sentence_case_decimal_point_is_not_a_boundary: fails on main without the fix and passes with it (cargo test -p deckcraft-model --lib sentence_case_decimal_point_is_not_a_boundary).
  • cargo xtask ci passes except tests::east_asian_vertical_text_stands_ideographs_upright, which also fails on main without this change.

Not changed

Title case, and '!' and '?' handling. A '.' between digits is the only case treated differently. Other numeric formats, such as thousands separators written with a comma, are unchanged.

🤖 Generated with AI by ApolloOffice, see the Co-Authored-By trailers for the models

Summary by CodeRabbit

  • Bug Fixes
    • Sentence-case conversion now preserves lowercase text after decimal and version-number periods, while continuing to capitalize text after sentence-ending punctuation.

Found while testing crates/model/src/edit.rs:~505 (change_case_parts, sentence branch)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Sentence-case conversion now treats periods between ASCII digits as part of decimal and version numbers, not as sentence boundaries. Tests cover decimals, version numbers across text pieces, and ordinary sentence punctuation.

Changes: Sentence-case conversion

Layer / File(s) Summary
Decimal-aware sentence boundaries
crates/model/src/edit.rs
A private helper recognizes periods between ASCII digits. Sentence-case conversion skips these periods when detecting sentence boundaries. Tests cover decimal and version-number periods, including a version split across pieces, while confirming that ordinary sentence punctuation still starts a new sentence.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: echelon, dylanmtaylor

Merge Risk: Minimal · up to 76bd2

No merge-blocking issue was identified in the sentence-case change.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main behavior change: periods between digits no longer start a new sentence, so the next word stays lowercase in sentence case. The raw summary confirms the change to change_case_…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main behavior change: periods between digits no longer start a new sentence, so the next word stays lowercase in sentence case. The raw summary confirms the change to change_case_parts and is_decimal_point, and the objectives describe the same decimal-point handling. The title is specific and matches the changeset.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 02fbb6a and 76bd26c.

Files selected for processing: 1

  • crates/model/src/edit.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@aiongg aiongg added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 8, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review (Opus). Not a maintainer decision.

No blocking problems found.

Sentence case no longer treats a '.' between two ASCII digits as the end of a sentence. The check reads the characters of all runs, so it also works when the digits sit in different runs.

  • crates/model/src/edit.rs:502-504: is_decimal_point is bounds-safe: it guards i > 0 before all[i - 1] and uses get for i + 1, and i is always a valid index into all.
  • crates/model/src/edit.rs:540: only the sentence branch changes. Title case and the '!' and '?' handling stay as they were.
  • Other dotted tokens without digits on both sides, such as 'e.g.' or 'example.com', still start a new sentence. That matches the stated scope.

Claims checked:

  • verified: A '.' with an ASCII digit on each side no longer starts a new sentence in sentence case. (crates/model/src/edit.rs:540 sets start only when the '.' is not a decimal point, using is_decimal_point at crates/model/src/edit.rs:502-504, which checks that all[i-1] and all[i+1] are ASCII digits.)
  • verified: The check works when the digits are split across run boundaries. (crates/model/src/edit.rs:517 builds all from every part, and crates/model/src/edit.rs:530 uses the global index i = base + j, so the neighbours come from adjacent runs.)
  • verified: Regular sentence ends, title case, and '!' and '?' handling are unchanged. (crates/model/src/edit.rs:540: the title condition and the '!'/'?' match are untouched. The new term only applies when c == '.' and digits are on both sides.)

Reviewed at 76bd26c.

Recommendation: merge after CI and checks pass.

@aiongg aiongg self-assigned this Nov 8, 2026
@aiongg
aiongg merged commit 48e2203 into storytold:main Nov 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants