charmbracelet / mods

AI on the command line
MIT License
3.02k stars 116 forks source link

ANSI Escape Sequences Not Rendering Properly in "Window Console Host" when Retrieving Answers from OpenAI API #98

Open johnd0e opened 1 year ago

johnd0e commented 1 year ago

When using the latest version (mods do you like kittens) or v0.2 when piped to glow (mods do you like kittens | glow), ANSI escape sequences are not being rendered correctly in the "Window Console Host." Instead, raw codes like ←[38;5;252m←[0m←[38;5;252m←[0m ←[38;5;252m are displayed.

  1. This issue is specific to retrieving answers from the OpenAI API. Other cases such as usage messages and error messages display correctly.
  2. The issue is only observed in the "Window Console Host." "Windows Terminal" functions as expected with no display problems.

Although this issue is likely related to the "Window Console Host," there may be potential workarounds or solutions that could address the problem and improve the rendering of ANSI escape sequences in this context. Any insights or suggestions to resolve this issue would be greatly appreciated.

johnd0e commented 1 year ago

I do not know if this is possible to fix in mods/glow. But seems that this hack works: https://github.com/microsoft/terminal/issues/1817 (at least partly)

caarlos0 commented 4 months ago

I believe this was fixed long ago, will close it, let me know if its still happening.

thanks!

johnd0e commented 4 months ago

@caarlos0

No, this is still an issue for me @ Microsoft Windows [Version 10.0.19045.4529]

caarlos0 commented 4 months ago

so, is the problem in glow or mods? or both?

johnd0e commented 4 months ago

Well, I am not sure. May be with glow, but I have no other examples except mods.