fix(dsl): render tabs as a fixed-width gap

A literal tab advanced text to the next platform tab stop, which pushed
the rest of the line far enough to wrap it mid-phrase.

Replace each tab with an en space so the separator keeps a fixed, modest
width and the line breaks like ordinary text.
This commit is contained in:
OneWay authored and Evgenii committed 2026-09-21 20:11:40 +08:00
1 parent ed1e1db7f2
commit cf29f19511
1 file changed
+13
@@ -136,6 +136,15 @@ object DslAnnotatedParser {
}
}
fun appendText(value: String) {
if (value.isEmpty()) return
builder.append(value)
if (refStack.isNotEmpty()) {
refStack.last().second.append(value)
}
lastAppended = value.last()
}
fun marginIndent(tagName: String): Int {
if (tagName == "m" || tagName == "m0" || tagName == "m1") return 0
val margin = tagName.drop(1).toIntOrNull() ?: return 0
@@ -253,6 +262,10 @@ object DslAnnotatedParser {
}
i++
}
'\t' -> {
appendText("\u2002")
i++
}
else -> {
appendChar(char)