Skip to content

Commit

Permalink
Add getEnd() method in MarkdownRange (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw authored Dec 9, 2024
1 parent c452bb4 commit f2ef325
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private void applyRanges(@NonNull SpannableStringBuilder ssb, @NonNull List<Mark
private void applyRange(@NonNull SpannableStringBuilder ssb, @NonNull MarkdownRange markdownRange, @NonNull 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
public class MarkdownRange {
private final @NonNull String mType;
private final int mStart;
private final int mEnd;
private final int mLength;
private final int mDepth;

public MarkdownRange(@NonNull String type, int start, int length, int depth) {
mType = type;
mStart = start;
mEnd = start + length;
mLength = length;
mDepth = depth;
}
Expand All @@ -23,6 +25,10 @@ public int getStart() {
return mStart;
}

public int getEnd() {
return mEnd;
}

public int getLength() {
return mLength;
}
Expand Down

0 comments on commit f2ef325

Please sign in to comment.