Skip to content

Commit 8f58b79

Browse files
committed
Merge branch 'develop'
2 parents 0458178 + bd9769b commit 8f58b79

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

core/src/main/java/me/dkzwm/widget/fet/FormattedEditText.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -546,31 +546,33 @@ private void formatMask(final Editable editable) {
546546
nextCharIsText = true;
547547
indexInStyle += Character.charCount(ESCAPE_MASK_POINT);
548548
} else {
549-
String cur = new StringBuilder().appendCodePoint(charInStyle).toString();
549+
String stringInStyle =
550+
mFormatStyle.substring(indexInStyle, indexInStyle + charInStyleCount);
550551
if (mPlaceholderFilters != null) {
551552
PlaceholderConverter converter = mPlaceholderFilters.get(charInStyle);
552553
if (converter != null) {
553554
char[] chars = new char[indexInText];
554555
editable.getChars(0, indexInText, chars, 0);
555-
String textInStyle = converter.convert(String.valueOf(chars), cur);
556+
String textInStyle =
557+
converter.convert(String.valueOf(chars), stringInStyle);
556558
if (textInStyle == null
557559
|| textInStyle.codePointCount(0, textInStyle.length()) != 1) {
558560
throw new IllegalArgumentException(
559-
"the converted must be length one character");
561+
"The converted must be length one character");
560562
}
561-
cur = textInStyle;
563+
stringInStyle = textInStyle;
564+
charInStyleCount = stringInStyle.length();
562565
}
563566
}
564-
int charCount = cur.length();
565-
editable.insert(indexInText, cur);
567+
editable.insert(indexInText, stringInStyle);
566568
editable.setSpan(
567569
new PlaceholderSpan(),
568570
indexInText,
569-
indexInText + charCount,
571+
indexInText + charInStyleCount,
570572
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
571573
nextCharIsText = false;
572-
indexInText += charCount;
573-
indexInStyle += charCount;
574+
indexInText += charInStyleCount;
575+
indexInStyle += charInStyleCount;
574576
}
575577
}
576578
if (!havingEmptyOrHint && indexOfLastLiteral != editable.length()) {

0 commit comments

Comments
 (0)