pub fn truncate_long_matched_lines<T>(
    lines: impl IntoIterator<Item = (SourceItem, T, Vec<usize>)>,
    winwidth: usize,
    skipped: Option<usize>,
) -> (Vec<(String, T, Vec<usize>)>, LinesTruncatedMap) {
    let mut truncated_map = HashMap::new();
    let mut lnum = 0usize;
    let winwidth = winwidth - WINWIDTH_OFFSET;
    let lines = lines
        .into_iter()
        .map(|(item, score, indices)| {
            let line = item.display_text.unwrap_or(item.raw);
            lnum += 1;

            if let Some((truncated, truncated_indices)) =
                truncate_line_impl(winwidth, &line, &indices, skipped)
            {
                truncated_map.insert(lnum, line);
                (truncated, score, truncated_indices)
            } else {
                (line, score, indices)
            }
        })
        .collect::<Vec<_>>();
    (lines, truncated_map)
}
/// Long matched lines can cause the matched items invisible.
///
/// # Arguments
///
/// - winwidth: width of the display window.
/// - skipped: number of skipped chars, used when need to skip the leading icons.
Long matched lines can cause the matched items invisible.
Arguments

width of the display window.
skipped: number of skipped chars, used when need to skip the leading icons.
Long matched lines can cause the matched items invisible . Arguments width of the display window . skipped : number of skipped chars used when need to skip the leading icons .
pub fn truncate_long_matched_lines<T>(
    lines: impl IntoIterator<Item = (SourceItem, T, Vec<usize>)>,
    winwidth: usize,
    skipped: Option<usize>,
) -> (Vec<(String, T, Vec<usize>)>, LinesTruncatedMap) {
    let mut truncated_map = HashMap::new();
    let mut lnum = 0usize;
    let winwidth = winwidth - WINWIDTH_OFFSET;
    let lines = lines
        .into_iter()
        .map(|(item, score, indices)| {
            let line = item.display_text.unwrap_or(item.raw);
            lnum += 1;
            if let Some((truncated, truncated_indices)) =
                truncate_line_impl(winwidth, &line, &indices, skipped)
            {
                truncated_map.insert(lnum, line);
                (truncated, score, truncated_indices)
            } else {
                (line, score, indices)
            }
        })
        .collect::<Vec<_>>();
    (lines, truncated_map)
}
pub fn truncate_long_matched_lines < T > ( lines : impl IntoIterator < Item = ( SourceItem , T , Vec < usize > ) > , winwidth : usize , skipped : Option < usize > , ) -> ( Vec < ( String , T , Vec < usize > ) > , LinesTruncatedMap ) { let mut truncated_map = HashMap :: new ( ) ; let mut lnum = 0usize ; let winwidth = winwidth - WINWIDTH_OFFSET ; let lines = lines . into_iter ( ) . map ( | ( item , score , indices ) | { let line = item . display_text . unwrap_or ( item . raw ) ; lnum += 1 ; if let Some ( ( truncated , truncated_indices ) ) = truncate_line_impl ( winwidth , & line , & indices , skipped ) { truncated_map . insert ( lnum , line ) ; ( truncated , score , truncated_indices ) } else { ( line , score , indices ) } } ) . collect :: < Vec < _ > > ( ) ; ( lines , truncated_map ) }
Long matched lines can cause the matched items invisible.
Long matched lines can cause the matched items invisible .
lines
impl IntoIterator<Item = (SourceItem, T, Vec<usize>)>
winwidth
usize
skipped
Option<usize>