mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 18:17:34 +00:00
Shell: Fix closest command node detection in Pipes and Sequences
This makes --option completions work for pipes and sequences too.
This commit is contained in:
parent
a9cee8ee02
commit
7f3e1fa826
1 changed files with 17 additions and 4 deletions
|
@ -1617,10 +1617,16 @@ HitTestResult Pipe::hit_test_position(size_t offset)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto result = m_left->hit_test_position(offset);
|
auto result = m_left->hit_test_position(offset);
|
||||||
if (result.matching_node)
|
if (result.matching_node) {
|
||||||
|
if (!result.closest_command_node)
|
||||||
|
result.closest_command_node = m_right;
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return m_right->hit_test_position(offset);
|
result = m_right->hit_test_position(offset);
|
||||||
|
if (!result.closest_command_node)
|
||||||
|
result.closest_command_node = m_right;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipe::Pipe(Position position, NonnullRefPtr<Node> left, NonnullRefPtr<Node> right)
|
Pipe::Pipe(Position position, NonnullRefPtr<Node> left, NonnullRefPtr<Node> right)
|
||||||
|
@ -1801,9 +1807,16 @@ HitTestResult Sequence::hit_test_position(size_t offset)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto result = m_left->hit_test_position(offset);
|
auto result = m_left->hit_test_position(offset);
|
||||||
if (result.matching_node)
|
if (result.matching_node) {
|
||||||
|
if (!result.closest_command_node)
|
||||||
|
result.closest_command_node = m_right;
|
||||||
return result;
|
return result;
|
||||||
return m_right->hit_test_position(offset);
|
}
|
||||||
|
|
||||||
|
result = m_right->hit_test_position(offset);
|
||||||
|
if (!result.closest_command_node)
|
||||||
|
result.closest_command_node = m_right;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence::Sequence(Position position, NonnullRefPtr<Node> left, NonnullRefPtr<Node> right, Position separator_position)
|
Sequence::Sequence(Position position, NonnullRefPtr<Node> left, NonnullRefPtr<Node> right, Position separator_position)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue