Skip to content

Commit d34f641

Browse files
Merge pull request #119 from snappdevelopment/fix-wrong-color-on-strings
Fix strings having the wrong color when containing numbers
2 parents e6a8d54 + 4726e84 commit d34f641

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ captures/
6161
.idea/studiobot.xml
6262
.idea/artifacts
6363
.idea/runConfigurations.xml
64+
.idea/AndroidProjectSystem.xml
6465

6566
.kotlin
6667

jsontree/src/commonMain/kotlin/com/sebastianneubauer/jsontree/AnnotatedText.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ internal fun rememberPrimitiveText(
8888
): AnnotatedString {
8989
val valueColor = remember(value) {
9090
when {
91+
value.isString -> colors.stringValueColor
92+
value.booleanOrNull != null -> colors.booleanValueColor
9193
value.doubleOrNull != null ||
9294
value.intOrNull != null ||
9395
value.floatOrNull != null ||
9496
value.longOrNull != null -> colors.numberValueColor
95-
value.booleanOrNull != null -> colors.booleanValueColor
96-
value.isString -> colors.stringValueColor
9797
else -> colors.nullValueColor
9898
}
9999
}

sample/src/commonMain/kotlin/JsonStrings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal val complexJson = """
2222
"url": "https://user.com",
2323
"description": "bargains independence smell sharing electric extra failures wallpaper freelance higher mathematics disaster directed clicking elder anyone encountered living mattress drill",
2424
"verified": true,
25-
"salary": 38775,
25+
"salary": "38775",
2626
"newValue": null
2727
},
2828
{

0 commit comments

Comments
 (0)