fix: skip auto-commit when committed reading is shorter than 2 kana#213
fix: skip auto-commit when committed reading is shorter than 2 kana#213
Conversation
There was a problem hiding this comment.
Pull request overview
Prevents premature auto-commit in lex-session when the Viterbi best path begins with a single-kana segment, which can break longer-word conversions during incremental typing.
Changes:
- Add a minimum committed reading length check (>= 2 chars) before auto-commit triggers.
- Document why single-kana auto-commits are harmful for longer, still-in-progress words.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When typing "jenosaid" (じぇのさいど→ジェノサイド), the Viterbi segmented intermediate input as [自(じ), ぇ, 之(の), 再(さい)], causing auto-commit to fire on the single-kana first segment "じ". This destroyed the longer word boundary, making it impossible to produce "ジェノサイド". Add a minimum committed reading length check (>= 2 chars) to prevent premature auto-commit of single-kana segments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Compute committed_reading.chars().count() once and reuse for both the minimum-length guard and kana slicing - Add test_auto_commit_skips_single_kana_first_segment regression test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3a58211 to
52199e9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Assert resp.commit.is_none() and kana unchanged directly, instead of only checking committed text length. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Only apply single-kana auto-commit guard to hiragana readings (ASCII prefixes like URLs are not affected) - Add stability precondition assert in regression test to ensure the test actually exercises the min-length guard Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Test plan
cargo fmt --all --check && cargo clippy --workspace --all-features -- -D warnings && cargo test --workspace --all-featuresall pass🤖 Generated with Claude Code