diff --git a/lib/models/documents/nodes/line.dart b/lib/models/documents/nodes/line.dart index 537a14b8..2727e101 100644 --- a/lib/models/documents/nodes/line.dart +++ b/lib/models/documents/nodes/line.dart @@ -56,6 +56,13 @@ class Line extends Container { @override String toPlainText() => super.toPlainText() + '\n'; + @override + String toString() { + final body = children.join(' → '); + final styleString = style.isNotEmpty ? ' $style' : ''; + return '¶ $body ⏎$styleString'; + } + @override insert(int index, Object data, Style style) { if (data is Embeddable) { @@ -98,12 +105,13 @@ class Line extends Container { } int thisLen = this.length; - int local = math.min(thisLen - index, length); - assert(style.values.every((attr) => attr.scope == AttributeScope.BLOCK)); + int local = math.min(thisLen - index, len); if (index + local == thisLen && local == 1) { + assert(style.values.every((attr) => attr.scope == AttributeScope.BLOCK)); _format(style); } else { + assert(style.values.every((attr) => attr.scope == AttributeScope.INLINE)); assert(index + local != thisLen); super.retain(index, local, style); }