|
|
@ -56,6 +56,13 @@ class Line extends Container<Leaf> { |
|
|
|
@override |
|
|
|
@override |
|
|
|
String toPlainText() => super.toPlainText() + '\n'; |
|
|
|
String toPlainText() => super.toPlainText() + '\n'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
|
|
String toString() { |
|
|
|
|
|
|
|
final body = children.join(' → '); |
|
|
|
|
|
|
|
final styleString = style.isNotEmpty ? ' $style' : ''; |
|
|
|
|
|
|
|
return '¶ $body ⏎$styleString'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
insert(int index, Object data, Style style) { |
|
|
|
insert(int index, Object data, Style style) { |
|
|
|
if (data is Embeddable) { |
|
|
|
if (data is Embeddable) { |
|
|
@ -98,12 +105,13 @@ class Line extends Container<Leaf> { |
|
|
|
} |
|
|
|
} |
|
|
|
int thisLen = this.length; |
|
|
|
int thisLen = this.length; |
|
|
|
|
|
|
|
|
|
|
|
int local = math.min(thisLen - index, length); |
|
|
|
int local = math.min(thisLen - index, len); |
|
|
|
assert(style.values.every((attr) => attr.scope == AttributeScope.BLOCK)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (index + local == thisLen && local == 1) { |
|
|
|
if (index + local == thisLen && local == 1) { |
|
|
|
|
|
|
|
assert(style.values.every((attr) => attr.scope == AttributeScope.BLOCK)); |
|
|
|
_format(style); |
|
|
|
_format(style); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
assert(style.values.every((attr) => attr.scope == AttributeScope.INLINE)); |
|
|
|
assert(index + local != thisLen); |
|
|
|
assert(index + local != thisLen); |
|
|
|
super.retain(index, local, style); |
|
|
|
super.retain(index, local, style); |
|
|
|
} |
|
|
|
} |
|
|
|