Skip to content

fix: 文字列内で同じ文字に対して同じルビを振った場合に文字数のカウントが不正になる不具合を修正しました#1

Open
SatoruUeda wants to merge 1 commit into
ina-amagami:masterfrom
SatoruUeda:ueda/fix_same_word
Open

fix: 文字列内で同じ文字に対して同じルビを振った場合に文字数のカウントが不正になる不具合を修正しました#1
SatoruUeda wants to merge 1 commit into
ina-amagami:masterfrom
SatoruUeda:ueda/fix_same_word

Conversation

@SatoruUeda

@SatoruUeda SatoruUeda commented Jul 2, 2025

Copy link
Copy Markdown

<r=わたし>私</r>と<r=わたし>私</r>の好きなもの

という文字列に対して処理を実施した場合

var match = TMProRubyUtil.TagRegex.Match(text);
で取得した先頭の「<r=わたし>私」のルビ情報をm_rubyInfosに入れた後

text = text.Replace(match.Groups[0].Value, kanji.Value);
で全ての「<r=わたし>私」を「私」に置換してしまうため、OnUpdateでのrubyAddedCountへの加算が不十分となり文字列を最後まで表示できない不具合が発生していました

text.Replaceで全てを置換するのではなくregex.Replaceで1つずつ置換することによって、同じ漢字と同じルビの組み合わせがあっても正常に動作するようにしました

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.

1 participant