pub fn complete_path(&self, line: &str, pos: usize) -> Result<(usize, Vec<Pair>)> {
        let (start, path, _, esc_char, break_chars, quote) =
            if let Some((idx, quote)) = find_unclosed_quote(&line[..pos]) {
                let start = idx + 1;
                if quote == Quote::Double {
                    (
                        start,
                        unescape(&line[start..pos], DOUBLE_QUOTES_ESCAPE_CHAR),
                        Borrowed(&line[..pos]),
                        DOUBLE_QUOTES_ESCAPE_CHAR,
                        &self.double_quotes_special_chars,
                        quote,
                    )
                } else {
                    (
                        start,
                        Borrowed(&line[start..pos]),
                        Borrowed(&line[..pos]),
                        None,
                        &self.break_chars,
                        quote,
                    )
                }
            } else {
                let (start, path) = extract_word(line, pos, ESCAPE_CHAR, self.break_chars);
                (
                    start,
                    unescape(path, ESCAPE_CHAR),
                    Borrowed(path),
                    ESCAPE_CHAR,
                    &self.break_chars,
                    Quote::None,
                )
            };

        let mut matches = if should_complete_executable(&path, line, start) {
            bin_complete(&path, esc_char, break_chars, quote)
        } else {
            filename_complete(&path, esc_char, break_chars, quote)
        };

        #[allow(clippy::unnecessary_sort_by)]
        matches.sort_by(|a, b| a.display().cmp(b.display()));
        Ok((start, matches))
    }
/// Takes the currently edited `line` with the cursor `pos`ition and
/// returns the start position and the completion candidates for the
/// partial path to be completed.
Takes the currently edited `line` with the cursor `pos`ition and
returns the start position and the completion candidates for the
partial path to be completed.
Takes the currently edited ` line ` with the cursor ` pos ` ition and returns the start position and the completion candidates for the partial path to be completed .
pub fn complete_path(&self, line: &str, pos: usize) -> Result<(usize, Vec<Pair>)> {
        let (start, path, _, esc_char, break_chars, quote) =
            if let Some((idx, quote)) = find_unclosed_quote(&line[..pos]) {
                let start = idx + 1;
                if quote == Quote::Double {
                    (
                        start,
                        unescape(&line[start..pos], DOUBLE_QUOTES_ESCAPE_CHAR),
                        Borrowed(&line[..pos]),
                        DOUBLE_QUOTES_ESCAPE_CHAR,
                        &self.double_quotes_special_chars,
                        quote,
                    )
                } else {
                    (
                        start,
                        Borrowed(&line[start..pos]),
                        Borrowed(&line[..pos]),
                        None,
                        &self.break_chars,
                        quote,
                    )
                }
            } else {
                let (start, path) = extract_word(line, pos, ESCAPE_CHAR, self.break_chars);
                (
                    start,
                    unescape(path, ESCAPE_CHAR),
                    Borrowed(path),
                    ESCAPE_CHAR,
                    &self.break_chars,
                    Quote::None,
                )
            };
        let mut matches = if should_complete_executable(&path, line, start) {
            bin_complete(&path, esc_char, break_chars, quote)
        } else {
            filename_complete(&path, esc_char, break_chars, quote)
        };
        #[allow(clippy::unnecessary_sort_by)]
        matches.sort_by(|a, b| a.display().cmp(b.display()));
        Ok((start, matches))
    }
pub fn complete_path ( & self , line : & str , pos : usize ) -> Result < ( usize , Vec < Pair > ) > { let ( start , path , _ , esc_char , break_chars , quote ) = if let Some ( ( idx , quote ) ) = find_unclosed_quote ( & line [ .. pos ] ) { let start = idx + 1 ; if quote == Quote :: Double { ( start , unescape ( & line [ start .. pos ] , DOUBLE_QUOTES_ESCAPE_CHAR ) , Borrowed ( & line [ .. pos ] ) , DOUBLE_QUOTES_ESCAPE_CHAR , & self . double_quotes_special_chars , quote , ) } else { ( start , Borrowed ( & line [ start .. pos ] ) , Borrowed ( & line [ .. pos ] ) , None , & self . break_chars , quote , ) } } else { let ( start , path ) = extract_word ( line , pos , ESCAPE_CHAR , self . break_chars ) ; ( start , unescape ( path , ESCAPE_CHAR ) , Borrowed ( path ) , ESCAPE_CHAR , & self . break_chars , Quote :: None , ) } ; let mut matches = if should_complete_executable ( & path , line , start ) { bin_complete ( & path , esc_char , break_chars , quote ) } else { filename_complete ( & path , esc_char , break_chars , quote ) } ; # [ allow ( clippy unnecessary_sort_by ) ] matches . sort_by ( | a , b | a . display ( ) . cmp ( b . display ( ) ) ) ; Ok ( ( start , matches ) ) }
Takes the currently edited `line` with the cursor `pos`ition and
returns the start position and the completion candidates for the
partial path to be completed.
Takes the currently edited ` line ` with the cursor ` pos ` ition and returns the start position and the completion candidates for the partial path to be completed .
&self
line
&str
pos
usize