/// Interactively reads a line from `stdin`.
/// When an interrupt intervened, return None.
Interactively reads a line from `stdin`.
When an interrupt intervened, return None.
Interactively reads a line from ` stdin ` . When an interrupt intervened return None .
pub fn read_line(&mut self) -> Option<String> {
        self.context.editor.write_prompt();
        self.context.editor.display().unwrap();
        signal::prepare().unwrap();
        loop {
            // Received a something signal.
            if let Some(_sig) = signal::take() {
                let e = Event::from_event_kind(&Some(EventKind::Interrupt));
                if let Ok(Some(line)) = (e.handler)(&mut self.context, Vec::new()) {
                    self.context.editor.display().unwrap();
                    return Some(line);
                }
                self.context.editor.display().unwrap();
                return None;
            }
            if wait_input() {
                let mut ch: Vec<u8> = Vec::new();
                if self.read_char(&mut ch).is_ok() {
                    let res = self.find_bind(&ch);
                    let e = Event::from_event_kind(&res);
                    if let Ok(Some(line)) = (e.handler)(&mut self.context, ch) {
                        self.context.editor.display().unwrap();
                        return Some(line);
                    }
                    self.context.editor.display().unwrap();
                }
            }
        }
    }
pub fn read_line ( & mut self ) -> Option < String > { self . context . editor . write_prompt ( ) ; self . context . editor . display ( ) . unwrap ( ) ; signal :: prepare ( ) . unwrap ( ) ; loop { // Received a something signal. if let Some ( _sig ) = signal :: take ( ) { let e = Event :: from_event_kind ( & Some ( EventKind :: Interrupt ) ) ; if let Ok ( Some ( line ) ) = ( e . handler ) ( & mut self . context , Vec :: new ( ) ) { self . context . editor . display ( ) . unwrap ( ) ; return Some ( line ) ; } self . context . editor . display ( ) . unwrap ( ) ; return None ; } if wait_input ( ) { let mut ch : Vec < u8 > = Vec :: new ( ) ; if self . read_char ( & mut ch ) . is_ok ( ) { let res = self . find_bind ( & ch ) ; let e = Event :: from_event_kind ( & res ) ; if let Ok ( Some ( line ) ) = ( e . handler ) ( & mut self . context , ch ) { self . context . editor . display ( ) . unwrap ( ) ; return Some ( line ) ; } self . context . editor . display ( ) . unwrap ( ) ; } } } }
Interactively reads a line from `stdin`.
Interactively reads a line from ` stdin ` .
&mut self