mirror of
https://github.com/helix-editor/helix.git
synced 2024-08-17 06:40:47 +03:00
Respect injections in movement::move_parent_node_end
This commit is contained in:
parent
8b6565c839
commit
035b8eabdb
@ -573,16 +573,11 @@ pub fn move_parent_node_end(
|
||||
dir: Direction,
|
||||
movement: Movement,
|
||||
) -> Selection {
|
||||
let tree = syntax.tree();
|
||||
|
||||
selection.transform(|range| {
|
||||
let start_from = text.char_to_byte(range.from());
|
||||
let start_to = text.char_to_byte(range.to());
|
||||
|
||||
let mut node = match tree
|
||||
.root_node()
|
||||
.named_descendant_for_byte_range(start_from, start_to)
|
||||
{
|
||||
let mut node = match syntax.named_descendant_for_byte_range(start_from, start_to) {
|
||||
Some(node) => node,
|
||||
None => {
|
||||
log::debug!(
|
||||
|
@ -1352,6 +1352,12 @@ pub fn tree_for_byte_range(&self, start: usize, end: usize) -> &Tree {
|
||||
self.layers[container_id].tree()
|
||||
}
|
||||
|
||||
pub fn named_descendant_for_byte_range(&self, start: usize, end: usize) -> Option<Node<'_>> {
|
||||
self.tree_for_byte_range(start, end)
|
||||
.root_node()
|
||||
.named_descendant_for_byte_range(start, end)
|
||||
}
|
||||
|
||||
pub fn descendant_for_byte_range(&self, start: usize, end: usize) -> Option<Node<'_>> {
|
||||
self.tree_for_byte_range(start, end)
|
||||
.root_node()
|
||||
|
Loading…
Reference in New Issue
Block a user