1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-16 14:51:00 +00:00

Shell: Fix completing barewords with escapes

e.g. completing `foo\ bar` now works as expected.
This commit is contained in:
AnotherTest 2021-01-09 03:32:19 +03:30 committed by Andreas Kling
parent 7059ca9b15
commit 9523bcbfe1
3 changed files with 43 additions and 21 deletions

View file

@ -232,8 +232,8 @@ Vector<Line::CompletionSuggestion> Node::complete_for_editor(Shell& shell, size_
auto matching_node = hit_test_result.matching_node;
if (matching_node) {
if (matching_node->is_bareword()) {
auto corrected_offset = offset - matching_node->position().start_offset;
auto* node = static_cast<BarewordLiteral*>(matching_node.ptr());
auto corrected_offset = find_offset_into_node(node->text(), offset - matching_node->position().start_offset);
if (corrected_offset > node->text().length())
return {};