Repository: microsoft/terminal
File: src/cascadia/TerminalControl/ControlCore.cpp (C++)

Code before:
            _terminal->SetBlockSelection(!_terminal->IsBlockSelection());
            _updateSelection(false);
            return true;
        }
        return false;
    }

    void ControlCore::ToggleMarkMode()
    {
        auto lock = _terminal->LockForWriting();
        _terminal->ToggleMarkMode();
        _updateSelection(false);
    }

    bool ControlCore::IsInMarkMode() const
    {
        return _terminal->IsInMarkMode();
    }

    // Method Description:
    // - Pre-process text pasted (presumably from the clipboard)
    //   before sending it over the terminal's connection.
    void ControlCore::PasteText(const winrt::hstring& hstr)
    {
        _terminal->WritePastedText(hstr);
        _terminal->ClearSelection();
        _updateSelection(true);
        _terminal->TrySnapOnInput();
    }

    FontInfo ControlCore::GetFont() const
    {
        return _actualFont;
    }

    winrt::Windows::Foundation::Size ControlCore::FontSize() const noexcept
    {
        const auto fontSize = _actualFont.GetSize();
        return {
            ::base::saturated_cast<float>(fontSize.X),
            ::base::saturated_cast<float>(fontSize.Y)
        };
    }
    winrt::hstring ControlCore::FontFaceName() const noexcept
    {
        // This getter used to return _actualFont.GetFaceName(), however GetFaceName() returns a STL
        // string and we need to return a WinRT string. This would require an additional allocation.
        // This method is called 10/s by TSFInputControl at the time of writing.
        return _actualFontFaceName;
    }


Review comment (suggestion):
idle thought: maybe we file a follow up to change the shape of the markers when we're in block selection mode? idk.

Code after:
            _terminal->ClearSelection();
            _updateSelection();
        }

        // send data up for clipboard
        _CopyToClipboardHandlers(*this,
                                 winrt::make<CopyToClipboardEventArgs>(winrt::hstring{ textData },
                                                                       winrt::to_hstring(htmlData),
                                                                       winrt::to_hstring(rtfData),
                                                                       formats));
        return true;
    }

    void ControlCore::SelectAll()
    {
        auto lock = _terminal->LockForWriting();
        _terminal->SelectAll();
        _updateSelection();
    }

    bool ControlCore::ToggleBlockSelection()
    {
        auto lock = _terminal->LockForWriting();
        if (_terminal->IsSelectionActive())
        {
            _terminal->SetBlockSelection(!_terminal->IsBlockSelection());
            _renderer->TriggerSelection();
            // do not update the selection markers!
            // if we were showing them, keep it that way.
            // otherwise, continue to not show them
            return true;
        }
        return false;
    }

    void ControlCore::ToggleMarkMode()
    {
        auto lock = _terminal->LockForWriting();
        _terminal->ToggleMarkMode();
        _updateSelection();
    }

    bool ControlCore::IsInMarkMode() const
    {
        return _terminal->IsInMarkMode();
    }

    // Method Description:
    // - Pre-process text pasted (presumably from the clipboard)
    //   before sending it over the terminal's connection.
    void ControlCore::PasteText(const winrt::hstring& hstr)