diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 7ec7d434..e7dedaf5 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -93,7 +93,7 @@ impl menu::Item for CompletionItem { }) => value, }; // LSPs which send Color completion items include a 6 digit hex code at the end for the color. The extra 1 digit is for the '#' - text.get(text.len() - 7..) + text.get(text.len().checked_sub(7)?..) }) .and_then(Color::from_hex) .map_or("color".into(), |color| {