agent: Do not insert selection as context when selection is empty (#29031)
Release Notes: - N/A
This commit is contained in:
parent
87512d0814
commit
3538acec7c
@ -1813,7 +1813,10 @@ impl ContextEditor {
|
|||||||
.selections
|
.selections
|
||||||
.all_adjusted(cx)
|
.all_adjusted(cx)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|s| snapshot.anchor_after(s.start)..snapshot.anchor_before(s.end))
|
.filter_map(|s| {
|
||||||
|
(!s.is_empty())
|
||||||
|
.then(|| snapshot.anchor_after(s.start)..snapshot.anchor_before(s.end))
|
||||||
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
});
|
});
|
||||||
Some((selections, buffer))
|
Some((selections, buffer))
|
||||||
|
Loading…
Reference in New Issue
Block a user