Skip to content

fix: ++/--/== の後に文字列が続く場合は反応しないよう修正#117

Merged
buty4649 merged 1 commit intopepabo:mainfrom
Colorful12:fix/operator-must-be-at-end-of-line
Apr 10, 2026
Merged

fix: ++/--/== の後に文字列が続く場合は反応しないよう修正#117
buty4649 merged 1 commit intopepabo:mainfrom
Colorful12:fix/operator-must-be-at-end-of-line

Conversation

@Colorful12
Copy link
Copy Markdown

背景

:stamp1: Check it out :point-down::skin-tone-2:/ -- Settings のようなメッセージで、意図せず :stamp1: のポイントが減算されるという問題があった。

#114 は「絵文字などの間に文字がある場合にも反応してしまう」問題として修正されたが、元のコードでも絵文字とオペレーターの間に文字がある場合は反応しない実装になっていた。

実際の原因は、:point-down::skin-tone-2:/ -- の部分にあった。:skin-tone-2:-- が隣接(または近接)しており、これが正規表現にマッチしていた。

変更内容

根本的な解決策として、++/--/== の後に別の文字列が続く場合は反応しないよう正規表現を修正した。

userOperationPattern / emojiOperationPattern の末尾に [  ]*($|\n) を追加し、オペレーターの直後がスペースのみ・行末・改行の場合のみ反応するようにした。

これにより -- Settings のように -- の後に単語が続くケースでは反応しなくなる。

オペレーターの後に別の単語が続く場合(例: `:neko: -- Settings`)は
意図的な操作ではなく文章の一部である可能性が高いため、
++/--/== の直後がスペースのみ・行末・改行の場合のみ反応するよう正規表現を修正した。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@buty4649 buty4649 left a comment

Choose a reason for hiding this comment

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

thx!!

@buty4649 buty4649 enabled auto-merge April 10, 2026 08:20
@buty4649 buty4649 merged commit b28ce56 into pepabo:main Apr 10, 2026
2 checks passed
@pepabo-pr-maker pepabo-pr-maker bot mentioned this pull request Apr 10, 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.

2 participants