retach 0.10.0

Persistent terminal sessions with native scrollback passthrough
Documentation
//! `Screen` is fully usable without importing `TerminalEmulator`.
//! Deliberately imports ONLY `Screen` — if any call below resolves through
//! the trait, this file stops compiling and the inherent API has a hole.

use retach::screen::Screen;

#[test]
fn inherent_readers_work_without_trait_import() {
    let mut screen = Screen::new(20, 5, 100);
    screen.process(b"hi\r\nthere");

    assert_eq!(screen.cols(), 20);
    assert_eq!(screen.rows(), 5);

    assert_eq!(screen.visible_row(0).text(), "hi");
    assert_eq!(screen.visible_rows().count(), 5);

    let (x, y) = screen.cursor_position();
    assert_eq!(y, 1);
    assert!(x > 0);
    assert!(screen.cursor_visible());

    let style = screen.resolve_style(screen.visible_row(0)[0].style_id);
    assert!(!style.bold);

    assert_eq!(screen.title(), "");
    assert_eq!(screen.scrollback_len(), 0);
    assert_eq!(screen.scrollback_rows().count(), 0);
    assert_eq!(screen.scroll_region(), (0, 4));
    let _ = screen.modes();
    let _ = screen.cursor_shape();

    assert!(!screen.in_alt_screen());
    assert!(screen.take_responses().is_empty());
    assert!(screen.take_passthrough().is_empty());
    assert!(screen.take_queued_notifications().is_empty());
}

#[test]
fn inherent_scrollback_index_access() {
    let mut screen = Screen::new(10, 3, 100);
    screen.process(b"a\r\nb\r\nc\r\nd\r\ne");
    assert!(screen.scrollback_len() >= 2);
    assert_eq!(screen.scrollback_row(0).text(), "a"); // oldest first
}