tasks: Filter out run indicators outside of excerpt bounds instead of using saturating_sub (#11634)
This way we'll display run indicators around excerpt boundaries correctly. Release Notes: - N/A
This commit is contained in:
parent
358bc2d225
commit
b3dc31d7c9
1 changed files with 17 additions and 9 deletions
|
@ -3182,16 +3182,24 @@ impl MultiBufferSnapshot {
|
||||||
excerpt
|
excerpt
|
||||||
.buffer
|
.buffer
|
||||||
.runnable_ranges(excerpt.range.context.clone())
|
.runnable_ranges(excerpt.range.context.clone())
|
||||||
.map(move |mut runnable| {
|
.filter_map(move |mut runnable| {
|
||||||
// Re-base onto the excerpts coordinates in the multibuffer
|
// Re-base onto the excerpts coordinates in the multibuffer
|
||||||
runnable.run_range.start = excerpt_offset
|
//
|
||||||
+ runnable
|
// The node matching our runnables query might partially overlap with
|
||||||
.run_range
|
// the provided range. If the run indicator is outside of excerpt bounds, do not actually show it.
|
||||||
.start
|
if runnable.run_range.start < excerpt_buffer_start {
|
||||||
.saturating_sub(excerpt_buffer_start);
|
return None;
|
||||||
runnable.run_range.end = excerpt_offset
|
}
|
||||||
+ runnable.run_range.end.saturating_sub(excerpt_buffer_start);
|
if language::ToPoint::to_point(&runnable.run_range.end, &excerpt.buffer).row
|
||||||
runnable
|
> excerpt.max_buffer_row
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
runnable.run_range.start =
|
||||||
|
excerpt_offset + runnable.run_range.start - excerpt_buffer_start;
|
||||||
|
runnable.run_range.end =
|
||||||
|
excerpt_offset + runnable.run_range.end - excerpt_buffer_start;
|
||||||
|
Some(runnable)
|
||||||
})
|
})
|
||||||
.skip_while(move |runnable| runnable.run_range.end < range.start)
|
.skip_while(move |runnable| runnable.run_range.end < range.start)
|
||||||
.take_while(move |runnable| runnable.run_range.start < range.end)
|
.take_while(move |runnable| runnable.run_range.start < range.end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue