Skip to content

Commit

Permalink
In the tabcompletion code for timezones, recognize other conversion o…
Browse files Browse the repository at this point in the history
…perators
  • Loading branch information
eminence committed Feb 8, 2024
1 parent 9cca835 commit af8782c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions numbat-cli/src/completer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,19 @@ impl Completer for NumbatCompleter {
}

// does it look like we're tab-completing a timezone (via the conversion operator)?
let complete_tz = line.find("->").map_or(None, |convert_pos| {
if let Some(quote_pos) = line.rfind('"') {
if quote_pos > convert_pos && pos > quote_pos {
return Some(quote_pos + 1);
let complete_tz = line
.find("->")
.or_else(|| line.find("→"))
.or_else(|| line.find("➞"))
.or_else(|| line.find(" to "))
.map_or(None, |convert_pos| {
if let Some(quote_pos) = line.rfind('"') {
if quote_pos > convert_pos && pos > quote_pos {
return Some(quote_pos + 1);
}
}
}
None
});
None
});
if let Some(pos_word) = complete_tz {
let word_part = &line[pos_word..];
let matches = self
Expand Down

0 comments on commit af8782c

Please sign in to comment.