rivo / tview

Terminal UI library with rich, interactive widgets — written in Golang
MIT License
11.07k stars 575 forks source link

ANSI Escape Sequences #1022

Open mgale opened 2 months ago

mgale commented 2 months ago

Hello,

After reading the below issues with looks like the handling of ansi escape control sequences is not currently supported, can you confirm if that is the case still?

https://github.com/rivo/tview/issues/24 https://github.com/rivo/tview/issues/568 https://github.com/rivo/tview/issues/746

Do you think the following approach could work?

I have an incoming bytes stream that I was writing directly to a textview but instead I can try:

  1. Reading the bytes stream into a parser first
  2. If I detect an escape control sequence, for example clearing the screen I can execute the appropriate tview change.
  3. If I do not detect an escape control sequence write the bytes to the textview.

Thanks

rivo commented 2 months ago

can you confirm if that is the case still?

Apart from the ability to translate some common ANSI sequences into style tags, yes, this is still the case. Running an interactive application inside another application is the domain of utilities such as sceen or tmux and (currently) out of scope for tview.

instead I can try

Sure you can try that. I'm not familiar, however, with all the different ANSI sequences so I don't know if you'll be able to map them all to a TextView.