I am trying to write some session multiplexer like tmux (but without a server), I spawn a new process, with fork, create a slave pty and read from the master pty
the piped program (in my example cmatrix) sends ansi escape codes, I convert them to string via str::from_utf8, save them on a local buffer and when render is called, it dump the buffer
my buffer is Vec<String> , each string is a line, my render function is literally this
pub fn render(&self, area: Rect, buf: &mut Buffer) {
let buffer = self.process.buffer.lock().unwrap();
Text::from_iter(
buffer
.iter()
.skip(buffer.len().saturating_sub(area.height as usize))
.map(|s| s.as_str())
.map(Line::from),
)
.render(area, buf);
}
here is what I get when I run cmatrix
I guess it has to do something with the string conversions, but I am not sure how I can write prestyled text to ratatui and render the colors
