cursive-split-panel 0.0.6

Split panel for the Cursive TUI library
Documentation
use {
    cursive::{view::*, views::*, *},
    cursive_split_panel::*,
};

// We've added some actions (not enabled to default) to let you play around with
// the various features of split panel

// In addition to the default keys (shift left/right, up/down), try pressing the
// 'b', 'd', and 'o' keys

// And don't forget to try dragging the divider with the mouse!

fn main() {
    let mut cursive = default();

    cursive.add_fullscreen_layer(
        SplitPanel::default()
            .with_front(text_view().scrollable())
            .with_back(text_view().scrollable())
            .with_action(Action::ToggleBorder, 'b')
            .with_action(Action::ToggleVisibleDivider, 'd')
            .with_action(Action::ToggleOrientation, 'o')
            .full_screen(),
    );

    cursive.add_global_callback('q', |cursive| cursive.quit());

    cursive.run();
}

fn text_view() -> TextView {
    TextView::new(
        "Did you ever hear the tragedy of Darth Plagueis the Wise? I thought not. It's not a \
story the Jedi would tell you. It's a Sith legend. Darth Plagueis was a Dark Lord of the Sith, \
so powerful and so wise he could use the Force to influence the midichlorians to create life... \
He had such a knowledge of the dark side, he could even keep the ones he cared about from dying. \
The dark side of the Force is a pathway to many abilities some consider to be unnatural. He \
became so powerful... the only thing he was afraid of was losing his power, which eventually, of \
course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice \
killed him in his sleep. Ironic. He could save others from death, but not himself.",
    )
}