Skip to content

Commit 76d623e

Browse files
authored
Merge pull request #216 from wordpress-mobile/issue/cursor-end-of-non-empty-list-item
Cursor at end of non empty list item
2 parents 7787b73 + 6f4ccba commit 76d623e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,8 @@ class AztecParser {
285285
}
286286

287287
private fun withinList(out: StringBuilder, text: Spanned, start: Int, end: Int, list: AztecListSpan) {
288-
val newEnd = end - 1
289-
val listContent = text.subSequence(start..newEnd) as Spanned
290-
291288
out.append("<${list.getStartTag()}>")
292-
var lines = TextUtils.split(listContent.toString(), "\n")
289+
var lines = TextUtils.split(text.substring(start, end), "\n")
293290

294291
if (lines.isNotEmpty() && lines.last().isEmpty()) {
295292
lines = lines.take(lines.size - 1).toTypedArray()
@@ -317,7 +314,7 @@ class AztecParser {
317314
out.append("<li>")
318315
}
319316

320-
withinContent(out, text.subSequence(start..newEnd) as Spanned, lineStart, lineEnd)
317+
withinContent(out, text, start + lineStart, start + lineEnd)
321318

322319
// attempt to consume the cursor here to cater for an empty list item
323320
consumeCursorIfInInput(out, text, itemSpanStart)

0 commit comments

Comments
 (0)