Hello everyone, I have a very specific question wh...
# compose
m
Hello everyone, I have a very specific question which I believe I have an answer for myself but would like to know if others have a better idea ^^ I'm attempting to print the logcat output within an app and have used the
-v color
option but this uses ANSI codes such as
[32m
and Jetpack Compose
Text()
functions will print them literally. Does anyone know if there is a way to interpret the codes and display the colours for the string? My naive approach would be to manually parse the codes but I honestly would prefer not to 😅
z
Compose text does not support ANSI control characters out of the box if that’s what you’re asking - that would be a pretty ridiculous feature for a UI toolkit to support I think.
Would be neat to publish a library that parsed them to AnnotatedStrings or something though
m
Yeah that's what I assumed ^^ Very niche need but a library would be cool!
z
Bonus points if you support bell 😛
👀 1
😅 1
e
proper VT100/ANSI sequence parsing is hard
you could get the messages directly from the system instead of trying to parse a command's output: src/androidNativeMain/cinterop/logging.def src/androidNativeMain/kotlin/Logcat.kt src/androidMain/kotlin/Logcat.kt src/androidInstrumentedTest/kotlin/LogcatTest.kt (tbf there's still a bit of parsing involved, but it can't get confused by embedded newlines or other funny sequences inside messages)
oh nevermind I forgot that READ_LOGS was restricted to system only on real devices…