Skip to content

Commit

Permalink
Trim before completing in DefaultCompleter
Browse files Browse the repository at this point in the history
  • Loading branch information
ysthakur committed Jan 6, 2024
1 parent 789c690 commit 4342ff5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/completion/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ impl Completer for DefaultCompleter {
fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion> {
let mut span_line_whitespaces = 0;
let mut completions = vec![];
// TODO trimming here is only necessary if someone passes in text containing
// stuff after the cursor with `only_buffer_difference: false`
let line = if line.len() > pos { &line[..pos] } else { line };
if !line.is_empty() {
let mut split = line.split(' ').rev();
let mut span_line: String = String::new();
Expand Down

0 comments on commit 4342ff5

Please sign in to comment.