pub fn find_notes(suggest: bool) {
    pp!("Enter Filter | ");
    p!("Or Regex (re:\\d+)");

    if !suggest && !g_get_last_find().is_empty() {
        p!("Shift+F To Use Previous Filter");
    }

    let last_find = g_get_last_find();
    let suggestion = if suggest && !last_find.is_empty() {
        &last_find
    } else {
        ""
    };
    let filter = ask_string("Find", suggestion, true).to_lowercase();
    let mut found: Vec<(usize, String)> = vec![];
    if filter.is_empty() {
        return;
    }
    let info = format!("{}{}{} >", get_color(3), filter, get_color(2));

    if filter.starts_with("re:") {
        if let Ok(re) = Regex::new(format!("(?i){}", filter.replacen("re:", "", 1)).trim()) {
            for (i, line) in g_get_notes_vec().iter().enumerate() {
                if i == 0 {
                    continue;
                }
                if re.is_match(line) {
                    found.push((i, s!(line)))
                }
            }
        } else {
            return show_message(&format!("< Invalid Regex: {}", info));
        }
    } else {
        let ifilter = filter.to_lowercase();

        for (i, line) in g_get_notes_vec().iter().enumerate() {
            if i == 0 {
                continue;
            }
            if line.to_lowercase().contains(&ifilter) {
                found.push((i, s!(line)))
            }
        }
    }

    if found.is_empty() {
        return show_message(&format!("< No Results for {}", info));
    }

    g_set_last_find(filter);
    g_set_found(found);
    g_set_mode(s!("found"));
    next_found();
}
// Finds a note by a filter
// Case insensitive
// Substrings are counted
Finds a note by a filter
Case insensitive
Substrings are counted
Finds a note by a filter Case insensitive Substrings are counted
pub fn find_notes(suggest: bool) {
    pp!("Enter Filter | ");
    p!("Or Regex (re:\\d+)");
    if !suggest && !g_get_last_find().is_empty() {
        p!("Shift+F To Use Previous Filter");
    }
    let last_find = g_get_last_find();
    let suggestion = if suggest && !last_find.is_empty() {
        &last_find
    } else {
        ""
    };
    let filter = ask_string("Find", suggestion, true).to_lowercase();
    let mut found: Vec<(usize, String)> = vec![];
    if filter.is_empty() {
        return;
    }
    let info = format!("{}{}{} >", get_color(3), filter, get_color(2));
    if filter.starts_with("re:") {
        if let Ok(re) = Regex::new(format!("(?i){}", filter.replacen("re:", "", 1)).trim()) {
            for (i, line) in g_get_notes_vec().iter().enumerate() {
                if i == 0 {
                    continue;
                }
                if re.is_match(line) {
                    found.push((i, s!(line)))
                }
            }
        } else {
            return show_message(&format!("< Invalid Regex: {}", info));
        }
    } else {
        let ifilter = filter.to_lowercase();
        for (i, line) in g_get_notes_vec().iter().enumerate() {
            if i == 0 {
                continue;
            }
            if line.to_lowercase().contains(&ifilter) {
                found.push((i, s!(line)))
            }
        }
    }
    if found.is_empty() {
        return show_message(&format!("< No Results for {}", info));
    }
    g_set_last_find(filter);
    g_set_found(found);
    g_set_mode(s!("found"));
    next_found();
}
pub fn find_notes ( suggest : bool ) { pp ! ( " " ) ; p ! ( " \\ " ) ; if ! suggest && ! g_get_last_find ( ) . is_empty ( ) { p ! ( " " ) ; } let last_find = g_get_last_find ( ) ; let suggestion = if suggest && ! last_find . is_empty ( ) { & last_find } else { " " } ; let filter = ask_string ( " " , suggestion , true ) . to_lowercase ( ) ; let mut found : Vec < ( usize , String ) > = vec ! [ ] ; if filter . is_empty ( ) { return ; } let info = format ! ( " " get_color ( 3 ) filter get_color ( 2 ) ) ; if filter . starts_with ( " " ) { if let Ok ( re ) = Regex :: new ( format ! ( " " filter replacen ( " " " " 1 ) ) . trim ( ) ) { for ( i , line ) in g_get_notes_vec ( ) . iter ( ) . enumerate ( ) { if i == 0 { continue ; } if re . is_match ( line ) { found . push ( ( i , s ! ( line ) ) ) } } } else { return show_message ( & format ! ( " " info ) ) ; } } else { let ifilter = filter . to_lowercase ( ) ; for ( i , line ) in g_get_notes_vec ( ) . iter ( ) . enumerate ( ) { if i == 0 { continue ; } if line . to_lowercase ( ) . contains ( & ifilter ) { found . push ( ( i , s ! ( line ) ) ) } } } if found . is_empty ( ) { return show_message ( & format ! ( " " info ) ) ; } g_set_last_find ( filter ) ; g_set_found ( found ) ; g_set_mode ( s ! ( " " ) ) ; next_found ( ) ; }
Finds a note by a filter
Case insensitive
Substrings are counted
Finds a note by a filter Case insensitive Substrings are counted
suggest
bool