We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a43ef6 commit 3f41c95Copy full SHA for 3f41c95
app/src/main/java/com/avocat/http_wizard/ui/component/RichText.kt
@@ -23,13 +23,18 @@ fun RichText(
23
src: String,
24
type: RichTextType = RichTextType.JSON
25
) {
26
+ val tokens =
27
+ when (type) {
28
+ RichTextType.JSON -> JSONTokens
29
+ }
30
+
31
Text(buildAnnotatedString {
32
var i = 0
33
var result: MatchResult?
34
35
while (i < src.length) {
36
var isMatched = false
- for (token in JSONTokens) {
37
+ for (token in tokens) {
38
result = token.first.matchAt(src, i)
39
if (result != null) {
40
append(AnnotatedString(src.substring(result.range), SpanStyle(token.second)))
0 commit comments