|
25 | 25 | import java.nio.charset.Charset; |
26 | 26 | import java.nio.charset.UnsupportedCharsetException; |
27 | 27 |
|
28 | | -import org.fusesource.jansi.internal.MingwSupport; |
29 | 28 | import org.fusesource.jansi.internal.OSInfo; |
| 29 | +import org.fusesource.jansi.internal.stty.Stty; |
30 | 30 | import org.fusesource.jansi.io.AnsiOutputStream; |
31 | 31 | import org.fusesource.jansi.io.AnsiProcessor; |
32 | 32 | import org.fusesource.jansi.io.FastBufferedOutputStream; |
@@ -173,6 +173,22 @@ public class AnsiConsole { |
173 | 173 | * The name of the {@code ffm} provider. |
174 | 174 | */ |
175 | 175 | public static final String JANSI_PROVIDER_FFM = "ffm"; |
| 176 | + /** |
| 177 | + * The name of the {@code stty} provider. |
| 178 | + */ |
| 179 | + public static final String JANSI_PROVIDER_STTY = "stty"; |
| 180 | + |
| 181 | + /** |
| 182 | + * The name of the {@code native-image} provider. |
| 183 | + * <p>This provider uses the |
| 184 | + * <a href="https://www.graalvm.org/latest/reference-manual/native-image/native-code-interoperability/C-API/">Native Image C API</a> |
| 185 | + * to call native functions, so it is only available when building to native image. |
| 186 | + * Additionally, this provider currently does not support Windows. |
| 187 | + * <p>Note: This is not the only provider available on Native Image, |
| 188 | + * and it is usually recommended to use ffm or jni provider. |
| 189 | + * This provider is mainly used when building static native images linked to musl libc. |
| 190 | + */ |
| 191 | + public static final String JANSI_PROVIDER_NATIVE_IMAGE = "native-image"; |
176 | 192 |
|
177 | 193 | /** |
178 | 194 | * @deprecated this field will be made private in a future release, use {@link #sysOut()} instead |
@@ -306,10 +322,9 @@ private static AnsiPrintStream ansiStream(boolean stdout) { |
306 | 322 | processor = null; |
307 | 323 | type = AnsiType.Native; |
308 | 324 | installer = uninstaller = null; |
309 | | - MingwSupport mingw = new MingwSupport(); |
310 | | - String name = mingw.getConsoleName(stdout); |
| 325 | + String name = Stty.getConsoleName(stdout); |
311 | 326 | if (name != null && !name.isEmpty()) { |
312 | | - width = () -> mingw.getTerminalWidth(name); |
| 327 | + width = () -> Stty.getTerminalWidth(name); |
313 | 328 | } else { |
314 | 329 | width = () -> -1; |
315 | 330 | } |
|
0 commit comments