use saturating substraction to calculate Line ranges

This commit is contained in:
Diva M authored and David Peter committed 2021-10-17 21:21:23 +02:00
1 parent aed4ea144f
commit ce4ddc0911
1 file changed
+2 -1
+2 -1
View File
@@ -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));
}
}