Fix underflow potential
This commit is contained in:
parent
dd73233973
commit
ce8442a3d8
1 changed files with 1 additions and 1 deletions
|
@ -1079,7 +1079,7 @@ impl CopilotState {
|
|||
match direction {
|
||||
Direction::Prev => {
|
||||
self.active_completion_index = if self.active_completion_index == 0 {
|
||||
self.completions.len() - 1
|
||||
self.completions.len().saturating_sub(1)
|
||||
} else {
|
||||
self.active_completion_index - 1
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue