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),
                        DOUBLE_QUOTES_ESCAPE_CHAR,
                        &self.double_quotes_special_chars,
                        quote,
                    )
                } else {
                    (
                        start,
                        Borrowed(&line[start..pos]),
                        None,
                        &self.break_chars,
                        quote,
                    )
                }
            } else {
                let (start, path) = extract_word(line, pos, ESCAPE_CHAR, self.break_chars);
                let path = unescape(path, ESCAPE_CHAR);
                (start, path, ESCAPE_CHAR, &self.break_chars, Quote::None)
            };
        let mut matches = 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),
                        DOUBLE_QUOTES_ESCAPE_CHAR,
                        &self.double_quotes_special_chars,
                        quote,
                    )
                } else {
                    (
                        start,
                        Borrowed(&line[start..pos]),
                        None,
                        &self.break_chars,
                        quote,
                    )
                }
            } else {
                let (start, path) = extract_word(line, pos, ESCAPE_CHAR, self.break_chars);
                let path = unescape(path, ESCAPE_CHAR);
                (start, path, ESCAPE_CHAR, &self.break_chars, Quote::None)
            };
        let mut matches = 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 ) , DOUBLE_QUOTES_ESCAPE_CHAR , & self . double_quotes_special_chars , quote , ) } else { ( start , Borrowed ( & line [ start .. pos ] ) , None , & self . break_chars , quote , ) } } else { let ( start , path ) = extract_word ( line , pos , ESCAPE_CHAR , self . break_chars ) ; let path = unescape ( path , ESCAPE_CHAR ) ; ( start , path , ESCAPE_CHAR , & self . break_chars , Quote :: None ) } ; let mut matches = 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
&self
line
&str
pos
usize