mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-02 15:00:23 +00:00
Clamp end of visual git hunk to requested range
This commit is contained in:
parent
ecd44e6914
commit
cf72173282
1 changed files with 2 additions and 1 deletions
|
@ -2651,12 +2651,13 @@ impl MultiBufferSnapshot {
|
|||
|
||||
let range = excerpt.range.context.clone();
|
||||
let range_start_row = range.start.to_point(&excerpt.buffer).row;
|
||||
let range_end_row = range.end.to_point(&excerpt.buffer).row;
|
||||
let a = Some(excerpt.buffer.git_diff_hunks_in_range(range, reversed).map(
|
||||
move |mut hunk| {
|
||||
hunk.buffer_range.start = hunk.buffer_range.start.max(range_start_row)
|
||||
- range_start_row
|
||||
+ lines_advance;
|
||||
hunk.buffer_range.end = hunk.buffer_range.end.max(range_start_row)
|
||||
hunk.buffer_range.end = hunk.buffer_range.end.min(range_end_row + 1)
|
||||
- range_start_row
|
||||
+ lines_advance;
|
||||
hunk
|
||||
|
|
Loading…
Reference in a new issue