Make expand excerpt apply to all excerpts in selections (#22748)
Closes #22720 Release Notes: - `ExpandExcerpts` (`shift+enter` by default) now expands all excerpts that have selected text, rather than just excerpts that contain the end of a selection.
This commit is contained in:
parent
810b37c129
commit
e56b692036
1 changed files with 12 additions and 9 deletions
|
@ -9109,15 +9109,18 @@ impl Editor {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.buffer.update(cx, |buffer, cx| {
|
self.buffer.update(cx, |buffer, cx| {
|
||||||
buffer.expand_excerpts(
|
let snapshot = buffer.snapshot(cx);
|
||||||
selections
|
let mut excerpt_ids = selections
|
||||||
.iter()
|
.iter()
|
||||||
.map(|selection| selection.head().excerpt_id)
|
.flat_map(|selection| {
|
||||||
.dedup(),
|
snapshot
|
||||||
lines,
|
.excerpts_for_range(selection.range())
|
||||||
direction,
|
.map(|excerpt| excerpt.id())
|
||||||
cx,
|
})
|
||||||
)
|
.collect::<Vec<_>>();
|
||||||
|
excerpt_ids.sort();
|
||||||
|
excerpt_ids.dedup();
|
||||||
|
buffer.expand_excerpts(excerpt_ids, lines, direction, cx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue