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

Code before:
bool Pane::_IsAdjacent(const PanePoint firstOffset,
                       const PanePoint secondOffset,
                       const FocusDirection& direction) const
{
    // Since float equality is tricky (arithmetic is non-associative, commutative),
    // test if the two numbers are within an epsilon distance of each other.
    auto floatEqual = [](float left, float right) {
        return abs(left - right) < 1e-4F;
    };

    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

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

Code after:
// - true if the two panes are adjacent.
bool Pane::_IsAdjacent(const PanePoint firstOffset,
                       const PanePoint secondOffset,
                       const FocusDirection& direction) const
{
    // Since float equality is tricky (arithmetic is non-associative, commutative),
    // test if the two numbers are within an epsilon distance of each other.
    auto floatEqual = [](float left, float right) {
        return abs(left - right) < 1e-4F;
    };

    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