fix: 文字列内で同じ文字に対して同じルビを振った場合に文字数のカウントが不正になる不具合を修正しました#1
Open
SatoruUeda wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<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つずつ置換することによって、同じ漢字と同じルビの組み合わせがあっても正常に動作するようにしました