Skip to content

Commit b0b22d5

Browse files
Merge pull request #71 from SimonSchubert/refactor/simplify-highlightedtext-fallback
Refactor/simplify highlightedtext fallback
2 parents 7509632 + 154cadd commit b0b22d5

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

android/src/main/java/com/inspiredandroid/linuxcommandbibliotheca/ui/composables/CommandView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fun CommandView(
107107
addStyle(
108108
style = ParagraphStyle(), // Default ParagraphStyle
109109
start = 0,
110-
end = baseAnnotatedString.text.length
110+
end = baseAnnotatedString.text.length,
111111
)
112112
}
113113
}

android/src/main/java/com/inspiredandroid/linuxcommandbibliotheca/ui/composables/HighlightedText.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,17 @@ fun HighlightedText(
3434
) {
3535
if (pattern.isEmpty()) {
3636
Text(
37-
text,
37+
text = text,
3838
maxLines = maxLines,
3939
overflow = TextOverflow.Ellipsis,
4040
)
41+
} else if (text.equals(pattern, ignoreCase = true)) {
42+
Text(
43+
text = text,
44+
maxLines = maxLines,
45+
overflow = TextOverflow.Ellipsis,
46+
color = MaterialTheme.colors.primary,
47+
)
4148
} else {
4249
val highlightColor = MaterialTheme.colors.primary
4350
val annotatedString = remember(text, pattern, highlightColor) {

0 commit comments

Comments
 (0)