async fn run(&mut self, term: &mut Terminal) -> Result<(), ServicesOff> {
        self.init_run(term).await?;

        loop {
            let mut session = term.listen().await?;
            let event = session.event();
            let screen = session.screen();

            match event {
                Some(Event::Key(keys)) if screen.valid_size() => match keys {
                    KeyEvent {
                        main_key: Key::Esc,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => break,

                    KeyEvent {
                        main_key: Key::Up,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_up(screen),

                    KeyEvent {
                        main_key: Key::Down,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_down(screen),

                    KeyEvent {
                        main_key: Key::Left,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_left(screen),

                    KeyEvent {
                        main_key: Key::Right,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_right(screen),

                    KeyEvent {
                        main_key: Key::Enter,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => break,

                    _ => (),
                },

                Some(Event::Resize(evt)) => self.resized(evt, screen),

                _ => (),
            }
        }

        Ok(())
    }
/// Runs this selector and uses the given terminal.
Runs this selector and uses the given terminal.
Runs this selector and uses the given terminal .
async fn run(&mut self, term: &mut Terminal) -> Result<(), ServicesOff> {
        self.init_run(term).await?;
        loop {
            let mut session = term.listen().await?;
            let event = session.event();
            let screen = session.screen();
            match event {
                Some(Event::Key(keys)) if screen.valid_size() => match keys {
                    KeyEvent {
                        main_key: Key::Esc,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => break,
                    KeyEvent {
                        main_key: Key::Up,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_up(screen),
                    KeyEvent {
                        main_key: Key::Down,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_down(screen),
                    KeyEvent {
                        main_key: Key::Left,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_left(screen),
                    KeyEvent {
                        main_key: Key::Right,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => self.key_right(screen),
                    KeyEvent {
                        main_key: Key::Enter,
                        ctrl: false,
                        alt: false,
                        shift: false,
                    } => break,
                    _ => (),
                },
                Some(Event::Resize(evt)) => self.resized(evt, screen),
                _ => (),
            }
        }
        Ok(())
    }
async fn run ( & mut self , term : & mut Terminal ) -> Result < ( ) , ServicesOff > { self . init_run ( term ) . await ? ; loop { let mut session = term . listen ( ) . await ? ; let event = session . event ( ) ; let screen = session . screen ( ) ; match event { Some ( Event :: Key ( keys ) ) if screen . valid_size ( ) => match keys { KeyEvent { main_key : Key :: Esc , ctrl : false , alt : false , shift : false , } => break , KeyEvent { main_key : Key :: Up , ctrl : false , alt : false , shift : false , } => self . key_up ( screen ) , KeyEvent { main_key : Key :: Down , ctrl : false , alt : false , shift : false , } => self . key_down ( screen ) , KeyEvent { main_key : Key :: Left , ctrl : false , alt : false , shift : false , } => self . key_left ( screen ) , KeyEvent { main_key : Key :: Right , ctrl : false , alt : false , shift : false , } => self . key_right ( screen ) , KeyEvent { main_key : Key :: Enter , ctrl : false , alt : false , shift : false , } => break , _ => ( ) , } , Some ( Event :: Resize ( evt ) ) => self . resized ( evt , screen ) , _ => ( ) , } } Ok ( ( ) ) }
Runs this selector and uses the given terminal.
Runs this selector and uses the given terminal .
&mut self
term
&mut Terminal
&mut self
term
&mut Terminal