Repository: microsoft/terminal
File: src/cascadia/TerminalCore/TerminalSelection.cpp (C++)

Code before:
    case SelectionExpansion::Line:
        start = { bufferSize.Left(), start.Y };
        end = { bufferSize.RightInclusive(), end.Y };
        break;
    case SelectionExpansion::Word:
        start = _activeBuffer().GetWordStart(start, _wordDelimiters);
        end = _activeBuffer().GetWordEnd(end, _wordDelimiters);
        break;
    case SelectionExpansion::Char:
    default:
        // no expansion is necessary
        break;
    }
    return std::make_pair(start, end);
}

// Method Description:
// - enable/disable block selection (ALT + selection)
// Arguments:
// - isEnabled: new value for _blockSelection
void Terminal::SetBlockSelection(const bool isEnabled) noexcept
{
    _blockSelection = isEnabled;
}

bool Terminal::IsInQuickEditMode() const
{
    return _quickEditMode;
}

bool Terminal::IsInMarkMode() const
{
    return _markMode;
}

void Terminal::ToggleMarkMode()
{
    if (_markMode)
    {
        // Exit Mark Mode
        ClearSelection();
    }
    else
    {
        // Enter Mark Mode
        // NOTE: directly set cursor state. We already should have locked before calling this function.
        _activeBuffer().GetCursor().SetIsOn(false);
        const auto cursorPos{ _activeBuffer().GetCursor().GetPosition() };
        _selection = SelectionAnchors{};
        _selection->start = cursorPos;
        _selection->end = cursorPos;

Review comment (suggestion):
```suggestion
const bool Terminal::IsInQuickEditMode() const noexcept
```

Code after:
std::pair<til::point, til::point> Terminal::_ExpandSelectionAnchors(std::pair<til::point, til::point> anchors) const
{
    auto start = anchors.first;
    auto end = anchors.second;

    const auto bufferSize = _activeBuffer().GetSize();
    switch (_multiClickSelectionMode)
    {
    case SelectionExpansion::Line:
        start = { bufferSize.Left(), start.Y };
        end = { bufferSize.RightInclusive(), end.Y };
        break;
    case SelectionExpansion::Word:
        start = _activeBuffer().GetWordStart(start, _wordDelimiters);
        end = _activeBuffer().GetWordEnd(end, _wordDelimiters);
        break;
    case SelectionExpansion::Char:
    default:
        // no expansion is necessary
        break;
    }
    return std::make_pair(start, end);
}

// Method Description:
// - enable/disable block selection (ALT + selection)
// Arguments:
// - isEnabled: new value for _blockSelection
void Terminal::SetBlockSelection(const bool isEnabled) noexcept
{
    _blockSelection = isEnabled;
}

Terminal::SelectionInteractionMode Terminal::SelectionMode() const noexcept
{
    return _selectionMode;
}

void Terminal::ToggleMarkMode()
{
    if (_selectionMode == SelectionInteractionMode::Mark)
    {
        // Exit Mark Mode
        ClearSelection();
    }
    else
    {
        // Enter Mark Mode
        // NOTE: directly set cursor state. We already should have locked before calling this function.
        _activeBuffer().GetCursor().SetIsOn(false);
        const auto cursorPos{ _activeBuffer().GetCursor().GetPosition() };