How do you clear a console screen?
# kotlin-native
e
How do you clear a console screen?
c
Do you mean the standard output? You can print
\033c
if you're on a UNIX-based OS. I don't think it's possible cross-platform without using a big library that handles all drawing
e
Illegal escape character \0
system("clear") works but only in an actual terminal, not in the run tab
e
\033c
is spelled
\u001Bc
in Kotlin since we don't have octal escapes
but yes, the proper solution would involve
termcap
or
terminfo
on UNIX and Windows-specific APIs on Windows
m
If you end up doing it, it'd be a nice pull request for https://github.com/ajalt/mordant
e
also https://github.com/gradle/native-platform already has support for clear-to-end-of-line; clear-screen would be an easy addition
449 Views