ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
7.02k stars 428 forks source link

How ftxui directly displays terminal results #565

Open Kurama622 opened 1 year ago

Kurama622 commented 1 year ago

I want to implement a preview feature like the ranger and fzf.

I think the best way is to directly call third-party tools such as bat or ccat to return the terminal result directly in the subwindow, but I don't know how ftxui directly displays the terminal result, I can only get the terminal result as a string, and then add the color.

I want a preview effect

ArthurSonzogni commented 1 year ago

FTXUI doesn't support parsing terminal output, it only "produce" terminal output. That's the second time someone ask for it. It might worth implementing.

Kurama622 commented 1 year ago

dear ArthurSonzogni, I have made some new progress now, I pretended to be a tty to obtain the shell output with color, ftxui just needs to be displayed like a terminal, but I got the following situation. Is this because of what you said about ftxui Can't parse terminal output? ( Unable to parse color information([38;5;238m) from terminal output? ) image

ArthurSonzogni commented 1 year ago

Yes, we would have to create a function:

element terminalOutput(std::string)

that would parse the content of the line and emit some ftxui element.