on master help sign in
use saturating substraction to calculate Line ranges
commitce4ddc0911ab9201e34b5a8ae55fb6bec2537077 authorDiva M <divma@protonmail.com> dateSat 9 Oct 2021, 06:08 (5 years ago) parentaed4ea1
1 file changed+2−1
src/controller.rs+2−1
src/controller.rs+2−1
@@ -177,7 +177,8 @@ impl<'b> Controller<'b> {
177177 if let Some(line_changes) = line_changes {
178178 for &line in line_changes.keys() {
179179 let line = line as usize;
180− line_ranges.push(LineRange::new(line - context, line + context));
180+ line_ranges
181+ .push(LineRange::new(line.saturating_sub(context), line + context));
181182 }
182183 }
183184