veeso/tui-realm

[QUESTION] - List component persist highlighted string until new selection is made

Closed this issue · 1 comments

I am creating a list component like this

component: List::default()
    .borders(
        Borders::default()
            .modifiers(BorderType::Rounded)
            .color(Color::Yellow),
    )
    .title("Subreddit List", Alignment::Center)
    .scroll(true)
    .highlighted_color(Color::LightYellow)
    .rewind(true)
    .step(4)
    .rows(subreddits.iter().map(|s| vec![TextSpan::from(s)]).collect())
    .selected_line(0),

I want the first line to be the initial highlighted line. After that as I keep pressing down or scrolling through the list, I still want the highlight in the first selection to persist until I actually press enter and confirm a new selection. How can I do that ?

veeso commented

This is not possible using the stdlib component. I suggest you to extend the component implementing a wrapper MockComponent around the List