mirror of
https://github.com/sharkdp/bat
synced 2024-11-30 15:49:16 +00:00
use saturating substraction to calculate Line ranges
This commit is contained in:
parent
aed4ea144f
commit
ce4ddc0911
1 changed files with 2 additions and 1 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue