pub struct Complete { /* private fields */ }Expand description
Tab-completion state: candidates for the token at start, tail
the text after the cursor that the completion leaves alone, and
expect the whole line after the last insertion (an edit in
between restarts the match).
Implementations§
Source§impl Complete
impl Complete
Sourcepub fn token(buf: &str, cursor: usize, address_list: bool) -> (usize, String)
pub fn token(buf: &str, cursor: usize, address_list: bool) -> (usize, String)
Where the token to complete begins, and the token: what stands before the cursor, after the last comma before it at an address prompt (mutt’s address list) or from the start of the line elsewhere, leading space skipped.
Sourcepub fn cycle(&mut self, buf: &str) -> Option<((String, usize), String)>
pub fn cycle(&mut self, buf: &str) -> Option<((String, usize), String)>
Another Tab on an unchanged line: the next candidate (the line and the cursor), and the “match n/m” note. None when the line was edited since, or there is only one candidate.
Sourcepub fn first(
buf: &str,
cursor: usize,
start: usize,
candidates: Vec<String>,
) -> (Complete, (String, usize), Option<String>)
pub fn first( buf: &str, cursor: usize, start: usize, candidates: Vec<String>, ) -> (Complete, (String, usize), Option<String>)
A fresh match for the token Complete::token found before
cursor: the line with the first candidate in and the cursor
after it, the note when there are more, and the state for the
next Tab. What follows the cursor stays. candidates is not
empty.