a-kenji/tui-term

Looser coupling with `vt100`

Closed this issue · 2 comments

First off thanks for the wonderful library!

I'm curious about how you would feel about allowing users to use alternative terminal emulation libraries.

I think the interface would boil down to something along the lines of:

pub trait Screen {
    type C: Cell;

    fn cell(&self, row: u16, col: u16) -> Option<&Self::C>;
    fn hide_cursor(&self) -> bool;
    fn cursor_position(&self) -> (u16, u16);
}

pub trait Cell {
    fn contents(&self) -> Option<String>;
    fn apply(&self, cell: &mut ratatui::buffer::Cell);
}

This would be a breaking change due to PseudoTerminal::screen returning vt100::Screen

Background:
I'm hitting some of the scrollback issues and have some other functionality I want to add. I'd love to use tui-term with my forked vt100 while I wait for the changes to land upstream without forking tui-term as well.

I'd be more than happy to throw together a PR if that would be helpful.

Thank you for reaching out!
This sounds like a good idea to me.

This would be a breaking change due to PseudoTerminal::screen returning vt100::Screen

That sounds fine in the current stage of the project.

Id be happy to look over a PR, so we can discuss specifics.

Thank you for the contribution, and the thoughtful sketches.

#152 is now in the currently released version v0.1.9.0.