Skip to content

Commit 2854771

Browse files
author
Simon Schubert
committed
Fix max lines issue
1 parent f73957f commit 2854771

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ import com.inspiredandroid.linuxcommandbibliotheca.ui.theme.LinuxTheme
2727
*/
2828

2929
@Composable
30-
fun HighlightedText(text: String, pattern: String) {
30+
fun HighlightedText(
31+
text: String,
32+
pattern: String,
33+
maxLines: Int = 1,
34+
) {
3135
if (pattern.isEmpty()) {
3236
Text(
3337
text,
34-
maxLines = 1,
35-
softWrap = false,
38+
maxLines = maxLines,
3639
overflow = TextOverflow.Ellipsis,
3740
)
3841
} else {
@@ -52,8 +55,7 @@ fun HighlightedText(text: String, pattern: String) {
5255
}
5356
Text(
5457
text = annotatedString,
55-
maxLines = 1,
56-
softWrap = false,
58+
maxLines = maxLines,
5759
overflow = TextOverflow.Ellipsis,
5860
)
5961
}

android/src/main/java/com/inspiredandroid/linuxcommandbibliotheca/ui/screens/basicgroups/BasicGroupsScreen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ fun BasicGroupColumn(
7575
HighlightedText(
7676
text = basicGroup.description,
7777
pattern = searchText,
78+
maxLines = 3,
7879
)
7980
},
8081
icon = {

0 commit comments

Comments
 (0)