Fix, display full URL containing ':' in parseMetadataLine
This commit is contained in:
parent
b5fe1cc7ae
commit
facb79f397
1 changed files with 14 additions and 9 deletions
|
|
@ -84,23 +84,28 @@ val ColorMarker = Color(0xFF795548) // Marron
|
|||
val MarkerRegex = Regex("\\$\\{.*?\\}|\\$[^ \n]")
|
||||
|
||||
private fun AnnotatedString.Builder.parseMetadataLine(line: String) {
|
||||
val parts = line.split(":")
|
||||
val prefix = line.substringBefore(":", line)
|
||||
val hasColon = line.contains(":")
|
||||
|
||||
// M0:
|
||||
pushStyle(SpanStyle(color = ColorPrefixA, fontWeight = FontWeight.Bold))
|
||||
append(parts[0] + ":")
|
||||
append(prefix)
|
||||
if (hasColon) append(":")
|
||||
pop()
|
||||
|
||||
if (parts.size > 1) {
|
||||
val remaining = line.substring(parts[0].length + 1)
|
||||
if (hasColon) {
|
||||
val remaining = line.substringAfter(":")
|
||||
val segments = remaining.split("|")
|
||||
segments.forEachIndexed { i, seg ->
|
||||
if (seg.contains(":")) {
|
||||
val kv = seg.split(":")
|
||||
pushStyle(SpanStyle(color = ColorPrefixB)) // m:, r:, t:
|
||||
append(kv[0] + ":")
|
||||
val colonIndex = seg.indexOf(':')
|
||||
if (colonIndex > 0) {
|
||||
val key = seg.substring(0, colonIndex)
|
||||
val value = seg.substring(colonIndex + 1)
|
||||
pushStyle(SpanStyle(color = ColorPrefixB)) // m:, r:, t:, u:
|
||||
append("$key:")
|
||||
pop()
|
||||
pushStyle(SpanStyle(color = ColorValue))
|
||||
append(kv[1])
|
||||
append(value)
|
||||
pop()
|
||||
} else {
|
||||
append(seg)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue