pub fn from_primitive(intermediate: Option<&u8>, num: i64) -> Option<Mode> {
        let private = match intermediate {
            Some(b'?') => true,
            None => false,
            _ => return None,
        };

        if private {
            Some(match num {
                1 => Mode::CursorKeys,
                3 => Mode::DECCOLM,
                6 => Mode::Origin,
                7 => Mode::LineWrap,
                12 => Mode::BlinkingCursor,
                25 => Mode::ShowCursor,
                1000 => Mode::ReportMouseClicks,
                1002 => Mode::ReportCellMouseMotion,
                1003 => Mode::ReportAllMouseMotion,
                1004 => Mode::ReportFocusInOut,
                1005 => Mode::Utf8Mouse,
                1006 => Mode::SgrMouse,
                1007 => Mode::AlternateScroll,
                1049 => Mode::SwapScreenAndSetRestoreCursor,
                2004 => Mode::BracketedPaste,
                _ => {
                    trace!("[unimplemented] primitive mode: {}", num);
                    return None;
                },
            })
        } else {
            Some(match num {
                4 => Mode::Insert,
                20 => Mode::LineFeedNewLine,
                _ => return None,
            })
        }
    }
/// Create mode from a primitive
///
/// TODO lots of unhandled values..
Create mode from a primitive
TODO lots of unhandled values
Create mode from a primitive TODO lots of unhandled values
pub fn from_primitive(intermediate: Option<&u8>, num: i64) -> Option<Mode> {
        let private = match intermediate {
            Some(b'?') => true,
            None => false,
            _ => return None,
        };
        if private {
            Some(match num {
                1 => Mode::CursorKeys,
                3 => Mode::DECCOLM,
                6 => Mode::Origin,
                7 => Mode::LineWrap,
                12 => Mode::BlinkingCursor,
                25 => Mode::ShowCursor,
                1000 => Mode::ReportMouseClicks,
                1002 => Mode::ReportCellMouseMotion,
                1003 => Mode::ReportAllMouseMotion,
                1004 => Mode::ReportFocusInOut,
                1005 => Mode::Utf8Mouse,
                1006 => Mode::SgrMouse,
                1007 => Mode::AlternateScroll,
                1049 => Mode::SwapScreenAndSetRestoreCursor,
                2004 => Mode::BracketedPaste,
                _ => {
                    trace!("[unimplemented] primitive mode: {}", num);
                    return None;
                },
            })
        } else {
            Some(match num {
                4 => Mode::Insert,
                20 => Mode::LineFeedNewLine,
                _ => return None,
            })
        }
    }
pub fn from_primitive ( intermediate : Option < & u8 > , num : i64 ) -> Option < Mode > { let private = match intermediate { Some ( b'?' ) => true , None => false , _ => return None , } ; if private { Some ( match num { 1 => Mode :: CursorKeys , 3 => Mode :: DECCOLM , 6 => Mode :: Origin , 7 => Mode :: LineWrap , 12 => Mode :: BlinkingCursor , 25 => Mode :: ShowCursor , 1000 => Mode :: ReportMouseClicks , 1002 => Mode :: ReportCellMouseMotion , 1003 => Mode :: ReportAllMouseMotion , 1004 => Mode :: ReportFocusInOut , 1005 => Mode :: Utf8Mouse , 1006 => Mode :: SgrMouse , 1007 => Mode :: AlternateScroll , 1049 => Mode :: SwapScreenAndSetRestoreCursor , 2004 => Mode :: BracketedPaste , _ => { trace ! ( " " num ) ; return None ; } , } ) } else { Some ( match num { 4 => Mode :: Insert , 20 => Mode :: LineFeedNewLine , _ => return None , } ) } }
Create mode from a primitive
TODO lots of unhandled values..
Create mode from a primitive TODO lots of unhandled values ..
intermediate
Option<&u8>
num
i64
intermediate
Option<&u8>
num
i64