pub fn parse_kakoune_range(range_desc: &str) -> (KakouneRange, KakounePosition) {
    let mut parts = range_desc.split(',');
    let mut convert = || {
        let coords = parts.next().unwrap();
        let mut coords = coords.split('.');
        KakounePosition {
            line: coords.next().unwrap().parse().ok().unwrap(),
            column: coords.next().unwrap().parse().ok().unwrap(),
        }
    };
    let anchor = convert();
    let cursor = convert();
    let (start, end) = if anchor < cursor {
        (anchor, cursor)
    } else {
        (cursor, anchor)
    };
    (KakouneRange { start, end }, cursor)
}
/// Parse a range of the form <line1>.<column1>,<line2>.<column2>.
/// The range is normalized, so the lower coordinate comes first.
/// Returns the cursor position separately.
Parse a range of the form .,..
The range is normalized, so the lower coordinate comes first.
Returns the cursor position separately.
Parse a range of the form . .. The range is normalized so the lower coordinate comes first . Returns the cursor position separately .
pub fn parse_kakoune_range(range_desc: &str) -> (KakouneRange, KakounePosition) {
    let mut parts = range_desc.split(',');
    let mut convert = || {
        let coords = parts.next().unwrap();
        let mut coords = coords.split('.');
        KakounePosition {
            line: coords.next().unwrap().parse().ok().unwrap(),
            column: coords.next().unwrap().parse().ok().unwrap(),
        }
    };
    let anchor = convert();
    let cursor = convert();
    let (start, end) = if anchor < cursor {
        (anchor, cursor)
    } else {
        (cursor, anchor)
    };
    (KakouneRange { start, end }, cursor)
}
pub fn parse_kakoune_range ( range_desc : & str ) -> ( KakouneRange , KakounePosition ) { let mut parts = range_desc . split ( ',' ) ; let mut convert = | | { let coords = parts . next ( ) . unwrap ( ) ; let mut coords = coords . split ( '.' ) ; KakounePosition { line : coords . next ( ) . unwrap ( ) . parse ( ) . ok ( ) . unwrap ( ) , column : coords . next ( ) . unwrap ( ) . parse ( ) . ok ( ) . unwrap ( ) , } } ; let anchor = convert ( ) ; let cursor = convert ( ) ; let ( start , end ) = if anchor < cursor { ( anchor , cursor ) } else { ( cursor , anchor ) } ; ( KakouneRange { start , end } , cursor ) }
Parse a range of the form <line1>.<column1>,<line2>.<column2>.
Parse a range of the form <line1 > . <column1 > <line2 > . <column2 > .
range_desc
&str
range_desc
&str