Repository: microsoft/terminal
File: src/cascadia/TerminalApp/Pane.cpp (C++)

Code before:
    auto getXMax = [](PanePoint offset) {
        return offset.x + offset.scaleX;
    };

    auto getYMax = [](PanePoint offset) {
        return offset.y + offset.scaleY;
    };

    // When checking containment in a range, the range is half-closed, i.e. [x, x+w).
    // If the direction is left test that the left side of the first element is
    // next to the right side of the second element, and that the top left
    // corner of the first element is within the second element's height
    if (direction == FocusDirection::Left)
    {
        auto sharesBorders = floatEqual(firstOffset.x, getXMax(secondOffset));
        auto withinHeight = (firstOffset.y >= secondOffset.y) && (firstOffset.y < getYMax(secondOffset));

        return sharesBorders && withinHeight;
    }
    // If the direction is right test that the right side of the first element is
    // next to the left side of the second element, and that the top left
    // corner of the first element is within the second element's height
    else if (direction == FocusDirection::Right)
    {
        auto sharesBorders = floatEqual(getXMax(firstOffset), secondOffset.x);
        auto withinHeight = (firstOffset.y >= secondOffset.y) && (firstOffset.y < getYMax(secondOffset));

        return sharesBorders && withinHeight;
    }
    // If the direction is up test that the top side of the first element is
    // next to the bottom side of the second element, and that the top left
    // corner of the first element is within the second element's width
    else if (direction == FocusDirection::Up)
    {
        auto sharesBorders = floatEqual(firstOffset.y, getYMax(secondOffset));
        auto withinWidth = (firstOffset.x >= secondOffset.x) && (firstOffset.x < getXMax(secondOffset));

        return sharesBorders && withinWidth;
    }
    // If the direction is down test that the bottom side of the first element is
    // next to the top side of the second element, and that the top left
    // corner of the first element is within the second element's width
    else if (direction == FocusDirection::Down)
    {
        auto sharesBorders = floatEqual(getYMax(firstOffset), secondOffset.y);
        auto withinWidth = (firstOffset.x >= secondOffset.x) && (firstOffset.x < getXMax(secondOffset));

        return sharesBorders && withinWidth;
    }
    return false;
}

Review comment (suggestion):
```suggestion
        const auto sharesBorders = floatEqual(getXMax(firstOffset), secondOffset.x);
        const auto withinHeight = (firstOffset.y >= secondOffset.y) && (firstOffset.y < getYMax(secondOffset));
```

Code after:

    auto getXMax = [](PanePoint offset) {
        return offset.x + offset.scaleX;
    };

    auto getYMax = [](PanePoint offset) {
        return offset.y + offset.scaleY;
    };

    // When checking containment in a range, the range is half-closed, i.e. [x, x+w).
    // If the direction is left test that the left side of the first element is
    // next to the right side of the second element, and that the top left
    // corner of the first element is within the second element's height
    if (direction == FocusDirection::Left)
    {
        const auto sharesBorders = floatEqual(firstOffset.x, getXMax(secondOffset));
        const auto withinHeight = (firstOffset.y >= secondOffset.y) && (firstOffset.y < getYMax(secondOffset));

        return sharesBorders && withinHeight;
    }
    // If the direction is right test that the right side of the first element is
    // next to the left side of the second element, and that the top left
    // corner of the first element is within the second element's height
    else if (direction == FocusDirection::Right)
    {
        const auto sharesBorders = floatEqual(getXMax(firstOffset), secondOffset.x);
        const auto withinHeight = (firstOffset.y >= secondOffset.y) && (firstOffset.y < getYMax(secondOffset));

        return sharesBorders && withinHeight;
    }
    // If the direction is up test that the top side of the first element is
    // next to the bottom side of the second element, and that the top left
    // corner of the first element is within the second element's width
    else if (direction == FocusDirection::Up)
    {
        const auto sharesBorders = floatEqual(firstOffset.y, getYMax(secondOffset));
        const auto withinWidth = (firstOffset.x >= secondOffset.x) && (firstOffset.x < getXMax(secondOffset));

        return sharesBorders && withinWidth;
    }
    // If the direction is down test that the bottom side of the first element is
    // next to the top side of the second element, and that the top left
    // corner of the first element is within the second element's width
    else if (direction == FocusDirection::Down)
    {
        const auto sharesBorders = floatEqual(getYMax(firstOffset), secondOffset.y);
        const auto withinWidth = (firstOffset.x >= secondOffset.x) && (firstOffset.x < getXMax(secondOffset));

        return sharesBorders && withinWidth;
    }
    return false;