fusesource / jansi

Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
http://fusesource.github.io/jansi/
Apache License 2.0
1.11k stars 140 forks source link

Jansi for Windows Command Prompt #227

Closed BlazerYoo closed 11 months ago

BlazerYoo commented 2 years ago

Jansi doesn't seem for work for Windows Command Prompt. Could you please provide the Java program that was used for the following example from http://fusesource.github.io/jansi/? Thank you.

image

gnodet commented 2 years ago

The report is not detailed enough. Which exact windows version are you using and what does "doesn't seem to work" mean precisely ? Also, please run java -jar jansi-2.4.0.jar on your console and report the output.

codemonstur commented 1 year ago

I don't know what the OP is seeing. But I ran into a problem when trying to draw box drawing characters. When running java -jar jansi-2.4.1-SNAPSHOT.jar. I get this:

image

Data at the top:

Jansi 2.4.1-SNAPSHOT

library.jansi.path=
library.jansi.version=
Jansi native library loaded from C:\Users\jurgen\AppData\Local\Temp\jansi-2.4.1-c77d626c8a567efd-jansi.dll
   which was auto-extracted from jar:file:/C:/Projects/test/jansi/target/jansi-2.4.1-SNAPSHOT.jar!/org/fusesource/jansi/internal/native/Windows/x86_64/jansi.dll

os.name= Windows 11, os.version= 10.0, os.arch= amd64
file.encoding= UTF-8
java.version= 19, java.vendor= Oracle Corporation, java.home= C:\Programs\jdk-19

jansi.graceful=
jansi.mode=
jansi.out.mode=
jansi.err.mode=
jansi.colors=
jansi.out.colors=
jansi.err.colors=
jansi.passthrough= false
jansi.strip= false
jansi.force= false
jansi.noreset= false
org.fusesource.jansi.Ansi.disable= false

IS_WINDOWS: true
IS_CONEMU: false
IS_CYGWIN: false
IS_MSYSTEM: false

isatty(STDOUT_FILENO): 1, System.out is a terminal
isatty(STDERR_FILENO): 1, System.err is a terminal

Resulting Jansi modes for stout/stderr streams:
  - System.out: AnsiPrintStream{type=VirtualTerminal, colors=Colors16, mode=Default, resetAtUninstall=true}
  - System.err: AnsiPrintStream{type=VirtualTerminal, colors=Colors16, mode=Default, resetAtUninstall=true}
Processor types description:
  - Native: Supports ansi sequences natively
  - Unsupported: Ansi sequences are stripped out
  - VirtualTerminal: Supported through windows virtual terminal
  - Emulation: Emulated through using windows API console commands
  - Redirected: The stream is redirected to a file or a pipe
Colors support description:
  - Colors16: 16 colors
  - Colors256: 256 colors
  - TrueColor: 24-bit colors
Modes description:
  - Strip: Strip all ansi sequences
  - Default: Print ansi sequences if the stream is a terminal
  - Force: Always print ansi sequences, even if the stream is redirected

The box drawing issue is here: https://github.com/fusesource/jansi/issues/247

gnodet commented 11 months ago

Assuming this is a duplicate of #247