Skip to content

Commit

Permalink
Stop converting annotated prompt message to string
Browse files Browse the repository at this point in the history
This drops all styles.
  • Loading branch information
mattprecious committed Feb 19, 2025
1 parent 6bfd704 commit 43681f8
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/commonMain/kotlin/com/mattprecious/stacker/rendering/prompt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,14 @@ fun <T> InteractivePrompt(
) {
val printer = LocalPrinter.current
val prompt = remember(message) {
"$message${if (message.last().isLetterOrDigit()) ":" else ""}"
if (message.last().isLetterOrDigit()) {
buildAnnotatedString {
append(message)
append(':')
}
} else {
message
}
}

Column(
Expand All @@ -285,7 +292,14 @@ fun <T> InteractivePrompt(
when {
it.key == "Enter" -> {
state.select()?.let { selected ->
printer.printStatic("$prompt ${selected.value}")
printer.printStatic(
buildAnnotatedString {
append(prompt)
append(' ')
append(selected.value)
},
)

onSelected(selected.option)
}

Expand Down Expand Up @@ -316,7 +330,13 @@ fun <T> InteractivePrompt(
}
},
) {
Text("$prompt ${state.filter}")
Text(
buildAnnotatedString {
append(prompt)
append(' ')
append(state.filter)
},
)

state.filteredOptions.forEachIndexed { index, option ->
val text = buildAnnotatedString {
Expand Down

0 comments on commit 43681f8

Please sign in to comment.