mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05: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 {};
|
||||
|
||||
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 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)
|
||||
|
@ -1801,9 +1807,16 @@ HitTestResult Sequence::hit_test_position(size_t offset)
|
|||
return {};
|
||||
|
||||
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 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)
|
||||
|
|
Loading…
Reference in a new issue