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]")
|
val MarkerRegex = Regex("\\$\\{.*?\\}|\\$[^ \n]")
|
||||||
|
|
||||||
private fun AnnotatedString.Builder.parseMetadataLine(line: String) {
|
private fun AnnotatedString.Builder.parseMetadataLine(line: String) {
|
||||||
val parts = line.split(":")
|
val prefix = line.substringBefore(":", line)
|
||||||
|
val hasColon = line.contains(":")
|
||||||
|
|
||||||
// M0:
|
// M0:
|
||||||
pushStyle(SpanStyle(color = ColorPrefixA, fontWeight = FontWeight.Bold))
|
pushStyle(SpanStyle(color = ColorPrefixA, fontWeight = FontWeight.Bold))
|
||||||
append(parts[0] + ":")
|
append(prefix)
|
||||||
|
if (hasColon) append(":")
|
||||||
pop()
|
pop()
|
||||||
|
|
||||||
if (parts.size > 1) {
|
if (hasColon) {
|
||||||
val remaining = line.substring(parts[0].length + 1)
|
val remaining = line.substringAfter(":")
|
||||||
val segments = remaining.split("|")
|
val segments = remaining.split("|")
|
||||||
segments.forEachIndexed { i, seg ->
|
segments.forEachIndexed { i, seg ->
|
||||||
if (seg.contains(":")) {
|
val colonIndex = seg.indexOf(':')
|
||||||
val kv = seg.split(":")
|
if (colonIndex > 0) {
|
||||||
pushStyle(SpanStyle(color = ColorPrefixB)) // m:, r:, t:
|
val key = seg.substring(0, colonIndex)
|
||||||
append(kv[0] + ":")
|
val value = seg.substring(colonIndex + 1)
|
||||||
|
pushStyle(SpanStyle(color = ColorPrefixB)) // m:, r:, t:, u:
|
||||||
|
append("$key:")
|
||||||
pop()
|
pop()
|
||||||
pushStyle(SpanStyle(color = ColorValue))
|
pushStyle(SpanStyle(color = ColorValue))
|
||||||
append(kv[1])
|
append(value)
|
||||||
pop()
|
pop()
|
||||||
} else {
|
} else {
|
||||||
append(seg)
|
append(seg)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue