From ce4ddc0911ab9201e34b5a8ae55fb6bec2537077 Mon Sep 17 00:00:00 2001 From: Diva M Date: Sat, 9 Oct 2021 06:08:07 -0500 Subject: [PATCH] use saturating substraction to calculate Line ranges --- src/controller.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controller.rs b/src/controller.rs index a737f09b..d106d1f2 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -177,7 +177,8 @@ impl<'b> Controller<'b> { if let Some(line_changes) = line_changes { for &line in line_changes.keys() { let line = line as usize; - line_ranges.push(LineRange::new(line - context, line + context)); + line_ranges + .push(LineRange::new(line.saturating_sub(context), line + context)); } }