@@ -38,9 +38,23 @@ abstract class AztecListSpan(override var nestingLevel: Int,
3838 val listText = text.subSequence(spanStart, spanEnd) as Spanned
3939
4040 if (end - spanStart - 1 >= 0 && end - spanStart <= listText.length) {
41- val hasSublist = listText.getSpans(end - spanStart - 1 , end - spanStart, AztecListSpan ::class .java)
42- .any { it.nestingLevel > nestingLevel }
43- if (hasSublist) {
41+ // When outdenting an empty list item, a nested list span may begin at the
42+ // exact start of this line due to span boundary updates. That should not
43+ // suppress the indicator for the current line. Ignore sublists whose start
44+ // coincides with the current line start.
45+ val potentialSublists = listText.getSpans(end - spanStart - 1 , end - spanStart, AztecListSpan ::class .java)
46+ val hasBlockingSublist = potentialSublists.any { sub ->
47+ if (sub.nestingLevel <= nestingLevel) return @any false
48+ val subStart = listText.getSpanStart(sub)
49+ val lineStart = (listText.subSequence(0 , end - spanStart) as Spanned )
50+ .lastIndexOf(' \n ' ) + 1
51+ // Only treat as blocking if the nested list actually starts after the line start
52+ // (i.e., the next line belongs to a deeper list). If it starts exactly at the
53+ // line start, we are at the first character of that nested block, which should
54+ // still show the current line indicator.
55+ subStart > lineStart
56+ }
57+ if (hasBlockingSublist) {
4458 return null
4559 }
4660 }
0 commit comments