Repository: microsoft/terminal
File: src/cascadia/TerminalCore/Terminal.hpp (C++)

Code before:

#pragma region TextSelection
    // These methods are defined in TerminalSelection.cpp
    enum class SelectionDirection
    {
        Left,
        Right,
        Up,
        Down
    };

    enum class SelectionExpansion
    {
        Char,
        Word,
        Line, // Mouse selection only!
        Viewport,
        Buffer
    };
    void MultiClickSelection(const til::point viewportPos, SelectionExpansion expansionMode);
    void SetSelectionAnchor(const til::point position);
    void SetSelectionEnd(const til::point position, std::optional<SelectionExpansion> newExpansionMode = std::nullopt);
    void SetBlockSelection(const bool isEnabled) noexcept;
    void UpdateSelection(SelectionDirection direction, SelectionExpansion mode, ControlKeyStates mods);
    void SelectAll();
    bool IsInQuickEditMode() const;
    bool IsInMarkMode() const;
    void ToggleMarkMode();

    using UpdateSelectionParams = std::optional<std::pair<SelectionDirection, SelectionExpansion>>;
    UpdateSelectionParams ConvertKeyEventToUpdateSelectionParams(const ControlKeyStates mods, const WORD vkey) const;
    bool MovingEnd() const noexcept;
    bool MovingCursor() const noexcept;
    til::point SelectionStartForRendering() const;
    til::point SelectionEndForRendering() const;

    const TextBuffer::TextAndColor RetrieveSelectedTextFromBuffer(bool trimTrailingWhitespace);
#pragma endregion

private:
    std::function<void(std::wstring_view)> _pfnWriteInput;
    std::function<void()> _pfnWarningBell;
    std::function<void(std::wstring_view)> _pfnTitleChanged;
    std::function<void(std::wstring_view)> _pfnCopyToClipboard;

    // I've specifically put this instance here as it requires
    //   alignas(std::hardware_destructive_interference_size)
    // for best performance.
    //
    // But we can abuse the fact that the surrounding members rarely change and are huge
    // (std::function is like 64 bytes) to create some natural padding without wasting space.

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

Code after:

#pragma region TextSelection
    // These methods are defined in TerminalSelection.cpp
    enum class SelectionInteractionMode
    {
        None,
        Mouse,
        Keyboard,
        Mark
    };

    enum class SelectionDirection
    {
        Left,
        Right,
        Up,
        Down
    };

    enum class SelectionExpansion
    {
        Char,
        Word,
        Line, // Mouse selection only!
        Viewport,
        Buffer
    };

    enum class SelectionEndpoint
    {
        Start = 0x1,
        End = 0x2
    };

    void MultiClickSelection(const til::point viewportPos, SelectionExpansion expansionMode);
    void SetSelectionAnchor(const til::point position);
    void SetSelectionEnd(const til::point position, std::optional<SelectionExpansion> newExpansionMode = std::nullopt);
    void SetBlockSelection(const bool isEnabled) noexcept;
    void UpdateSelection(SelectionDirection direction, SelectionExpansion mode, ControlKeyStates mods);
    void SelectAll();
    SelectionInteractionMode SelectionMode() const noexcept;
    void ToggleMarkMode();

    using UpdateSelectionParams = std::optional<std::pair<SelectionDirection, SelectionExpansion>>;
    UpdateSelectionParams ConvertKeyEventToUpdateSelectionParams(const ControlKeyStates mods, const WORD vkey) const;
    til::point SelectionStartForRendering() const;
    til::point SelectionEndForRendering() const;
    const SelectionEndpoint SelectionEndpointTarget() const noexcept;

    const TextBuffer::TextAndColor RetrieveSelectedTextFromBuffer(bool trimTrailingWhitespace);
#pragma endregion