Skip to content

Commit efe5189

Browse files
committed
Follow the same logic when numbers are drawn on list items
1 parent a8b83f0 commit efe5189

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecOrderedListSpan.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ class AztecOrderedListSpan(
5555
p.color = listStyle.indicatorColor
5656
p.style = Paint.Style.FILL
5757

58-
var start = if (attributes.hasAttribute("start") == true) {
58+
val start = if (attributes.hasAttribute("start") == true) {
5959
attributes.getValue("start").toInt()
6060
} else {
6161
0
6262
}
6363

6464
val isReversed = attributes.hasAttribute("reversed")
65-
var lineIndex = if (start > 0) {
65+
val lineIndex = if (start > 0) {
6666
if (isReversed) start - (getIndexOfProcessedLine(text, end) - 1)
6767
else start + (getIndexOfProcessedLine(text, end) - 1)
6868
} else {
@@ -71,13 +71,9 @@ class AztecOrderedListSpan(
7171
else getIndexOfProcessedLine(text, end)
7272
}
7373

74-
val textToDraw = if (lineIndex > -1) {
75-
if (dir >= 0) lineIndex.toString() + "."
74+
val textToDraw = if (dir >= 0) lineIndex.toString() + "."
7675
else "." + lineIndex.toString()
77-
} else {
78-
""
79-
}
80-
76+
8177
val width = p.measureText(textToDraw)
8278
maxWidth = Math.max(maxWidth, width)
8379

0 commit comments

Comments
 (0)