Repository: microsoft/terminal
File: src/renderer/dx/DxRenderer.cpp (C++)

Code before:

        if (lines & GridLines::Top)
        {
            const auto y = target.y + halfGridlineWidth;
            DrawLine(startX, y, endX, y, _lineMetrics.gridlineWidth);
        }

        if (lines & GridLines::Bottom)
        {
            const auto y = target.y + font.height - halfGridlineWidth;
            DrawLine(startX, y, endX, y, _lineMetrics.gridlineWidth);
        }
    }

    // In the case of the underline and strikethrough offsets, the stroke width
    // is already accounted for, so they don't require further adjustments.

    if (lines & (GridLines::Underline | GridLines::DoubleUnderline | GridLines::HyperlinkUnderline))
    {
        const auto halfUnderlineWidth = _lineMetrics.underlineWidth / 2.0f;
        const auto startX = target.x + halfUnderlineWidth;
        const auto endX = target.x + fullRunWidth - halfUnderlineWidth;
        const auto y = target.y + _lineMetrics.underlineOffset;

        if (lines & GridLines::Underline)
        {
            DrawLine(startX, y, endX, y, _lineMetrics.underlineWidth);
        }

        if (lines & GridLines::HyperlinkUnderline)
        {
            DrawHyperlinkLine(startX, y, endX, y, _lineMetrics.underlineWidth);
        }

        if (lines & GridLines::DoubleUnderline)
        {
            const auto y2 = target.y + _lineMetrics.underlineOffset2;
            DrawLine(startX, y2, endX, y2, _lineMetrics.underlineWidth);
        }
    }

    if (lines & GridLines::Strikethrough)
    {
        const auto halfStrikethroughWidth = _lineMetrics.strikethroughWidth / 2.0f;
        const auto startX = target.x + halfStrikethroughWidth;
        const auto endX = target.x + fullRunWidth - halfStrikethroughWidth;
        const auto y = target.y + _lineMetrics.strikethroughOffset;

        DrawLine(startX, y, endX, y, _lineMetrics.strikethroughWidth);
    }


Review comment (suggestion):
You've changed the behavior of DoubleUnderline here. It was using this to draw its first line and then the second one below.

Code after:
        {
            const auto y = target.y + halfGridlineWidth;
            DrawLine(startX, y, endX, y, _lineMetrics.gridlineWidth);
        }

        if (lines & GridLines::Bottom)
        {
            const auto y = target.y + font.height - halfGridlineWidth;
            DrawLine(startX, y, endX, y, _lineMetrics.gridlineWidth);
        }
    }

    // In the case of the underline and strikethrough offsets, the stroke width
    // is already accounted for, so they don't require further adjustments.

    if (lines & (GridLines::Underline | GridLines::DoubleUnderline | GridLines::HyperlinkUnderline))
    {
        const auto halfUnderlineWidth = _lineMetrics.underlineWidth / 2.0f;
        const auto startX = target.x + halfUnderlineWidth;
        const auto endX = target.x + fullRunWidth - halfUnderlineWidth;
        const auto y = target.y + _lineMetrics.underlineOffset;

        if (lines & GridLines::Underline)
        {
            DrawLine(startX, y, endX, y, _lineMetrics.underlineWidth);
        }

        if (lines & GridLines::HyperlinkUnderline)
        {
            DrawHyperlinkLine(startX, y, endX, y, _lineMetrics.underlineWidth);
        }

        if (lines & GridLines::DoubleUnderline)
        {
            DrawLine(startX, y, endX, y, _lineMetrics.underlineWidth);
            const auto y2 = target.y + _lineMetrics.underlineOffset2;
            DrawLine(startX, y2, endX, y2, _lineMetrics.underlineWidth);
        }
    }

    if (lines & GridLines::Strikethrough)
    {
        const auto halfStrikethroughWidth = _lineMetrics.strikethroughWidth / 2.0f;
        const auto startX = target.x + halfStrikethroughWidth;
        const auto endX = target.x + fullRunWidth - halfStrikethroughWidth;
        const auto y = target.y + _lineMetrics.strikethroughOffset;

        DrawLine(startX, y, endX, y, _lineMetrics.strikethroughWidth);
    }

    return S_OK;