diff --git a/android/src/main/java/com/expensify/livemarkdown/MarkdownFormatter.java b/android/src/main/java/com/expensify/livemarkdown/MarkdownFormatter.java index 1fb1469e..ac737ebf 100644 --- a/android/src/main/java/com/expensify/livemarkdown/MarkdownFormatter.java +++ b/android/src/main/java/com/expensify/livemarkdown/MarkdownFormatter.java @@ -58,7 +58,7 @@ private void applyRanges(SpannableStringBuilder ssb, List markdow private void applyRange(SpannableStringBuilder ssb, MarkdownRange markdownRange, MarkdownStyle markdownStyle) { String type = markdownRange.getType(); int start = markdownRange.getStart(); - int end = start + markdownRange.getLength(); + int end = markdownRange.getEnd(); switch (type) { case "bold": setSpan(ssb, new MarkdownBoldSpan(), start, end); diff --git a/android/src/main/java/com/expensify/livemarkdown/MarkdownRange.java b/android/src/main/java/com/expensify/livemarkdown/MarkdownRange.java index 9c3aedd3..8da42e16 100644 --- a/android/src/main/java/com/expensify/livemarkdown/MarkdownRange.java +++ b/android/src/main/java/com/expensify/livemarkdown/MarkdownRange.java @@ -3,12 +3,14 @@ public class MarkdownRange { private final String mType; private final int mStart; + private final int mEnd; private final int mLength; private final int mDepth; public MarkdownRange(String type, int start, int length, int depth) { mType = type; mStart = start; + mEnd = start + length; mLength = length; mDepth = depth; } @@ -21,6 +23,10 @@ public int getStart() { return mStart; } + public int getEnd() { + return mEnd; + } + public int getLength() { return mLength; }