Skip to content

4桁の数字にMM/DD形式の日付候補を追加する - #366

Closed
sinoda1114 wants to merge 2 commits into
azooKey:mainfrom
sinoda1114:codex/mmdd-date-candidates
Closed

4桁の数字にMM/DD形式の日付候補を追加する#366
sinoda1114 wants to merge 2 commits into
azooKey:mainfrom
sinoda1114:codex/mmdd-date-candidates

Conversation

@sinoda1114

@sinoda1114 sinoda1114 commented Sep 5, 2026

Copy link
Copy Markdown

1111→11/11、0102→01/02の候補を追加します。全角数字にも対応し、元の数字を保持します。不正な月日は除外し、年を指定しない0229は許容します。

検証

月日境界・全角混在・候補選択と確定をテスト。

このブランチ単独で swift test --package-path Core --jobs 4 を実行し、Coreの78テストが成功しました。git diff --check も成功しています。

変換範囲と処理負荷

文節の変換範囲を縮めている間は全入力向けのMM/DD候補を追加しません。

Copilot AI lite review requested due to automatic review settings September 5, 2026 03:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T03:46:23.537002Z 5bde291 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

変更範囲が限定的で、仕様(全角対応・不正除外・0229許容・元数字保持)をカバーするテストが追加されており、候補注入の重複抑止も実装されています。

Pull request overview

4桁の数字入力(MMDD)から MM/DD 形式の月日候補を生成し、変換候補として提示できるようにするPRです。Core の変換候補生成(SegmentsManager)に月日候補の注入を追加し、全角/半角混在の数字入力や不正な月日の除外、年なしの 0229 許容をテストで担保しています。

Changes:

  • 4桁数字(半角/全角/混在)を MM/DD に変換する NumericDateShortcuts.monthDay(matching:) を追加
  • SegmentsManager の候補生成後に、月日候補を重複なしで mainResults に追加
  • 変換候補への反映・不正値除外・重複抑止・編集による出し入れをテスト追加(加えて README 記載)
File summaries
File Description
README.md 4桁数字→月日候補(MM/DD)変換機能の説明を追記
Core/Tests/CoreTests/InputUtilsTests/SegmentsManagerNumericDateTests.swift SegmentsManager 経由で月日候補が提示・確定されること/不正除外/重複抑止を検証
Core/Tests/CoreTests/InputUtilsTests/NumericDateShortcutsTests.swift 数字正規化(全角・混在)と月日妥当性(0229 許容含む)を単体検証
Core/Sources/Core/InputUtils/SegmentsManager.swift 変換候補取得後に月日候補を注入(重複チェック付き)
Core/Sources/Core/InputUtils/NumericDateShortcuts.swift 4桁の数字(ASCII/全角のみ)を MM/DD に変換するユーティリティを追加
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bde291232

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +577 to +582
if let monthDay = NumericDateShortcuts.monthDay(matching: self.composingText.convertTarget),
!result.mainResults.contains(where: { $0.text == monthDay }) {
let candidate = Candidate(
text: monthDay,
value: -18,
composingCount: .surfaceCount(self.composingText.convertTarget.count),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Limit the date shortcut to the active conversion segment

When the user invokes segment editing on a four-digit composition, editSegment moves convertTargetCursorPosition to delimit the active prefix while convertTarget still contains all four digits. This condition therefore continues to add an MM/DD candidate, and its .surfaceCount(convertTarget.count) consumes the entire composition when selected instead of only the edited segment. Derive the shortcut reading and composing count from the active conversion prefix, or suppress this whole-input shortcut while segment editing is active.

Useful? React with 👍 / 👎.

@ensan-hcl

Copy link
Copy Markdown
Member

これもAzooKeyKanaKanjiConverterのレイヤーで処理するのが適切なので、そのようにしたいです。

@ensan-hcl ensan-hcl closed this Sep 5, 2026
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.

3 participants