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:
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 {
|
fun marginIndent(tagName: String): Int {
|
||||||
if (tagName == "m" || tagName == "m0" || tagName == "m1") return 0
|
if (tagName == "m" || tagName == "m0" || tagName == "m1") return 0
|
||||||
val margin = tagName.drop(1).toIntOrNull() ?: return 0
|
val margin = tagName.drop(1).toIntOrNull() ?: return 0
|
||||||
@@ -253,6 +262,10 @@ object DslAnnotatedParser {
|
|||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
'\t' -> {
|
||||||
|
appendText("\u2002")
|
||||||
|
i++
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
appendChar(char)
|
appendChar(char)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user