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

Code before:
                }
                else if (multiClickMapper == 3)
                {
                    mode = ::Terminal::SelectionExpansionMode::Line;
                }

                if (ctrlEnabled && multiClickMapper == 1 &&
                    !(_terminal->GetHyperlinkAtPosition(terminalPosition).empty()))
                {
                    _HyperlinkHandler(_terminal->GetHyperlinkAtPosition(terminalPosition));
                }
                else
                {
                    // Update the selection appropriately

                    // Capture the position of the first click when no selection is active
                    if (mode == ::Terminal::SelectionExpansionMode::Cell && !_terminal->IsSelectionActive())
                    {
                        _singleClickTouchdownPos = cursorPosition;
                        _lastMouseClickPosNoSelection = cursorPosition;
                    }

                    // We reset the active selection if one of the conditions apply:
                    // - shift is not held
                    // - GH#9384: the position is the same as of the first click starting the selection
                    // (we need to reset selection on double-click or triple-click, so it captures the word  or the line,
                    // rather than extending the selection)
                    if (_terminal->IsSelectionActive() && (!shiftEnabled || _lastMouseClickPosNoSelection == cursorPosition))
                    {
                        // Reset the selection
                        _terminal->ClearSelection();
                        _selectionNeedsToBeCopied = false; // there's no selection, so there's nothing to update
                    }

                    if (shiftEnabled)
                    {
                        if (_terminal->IsSelectionActive())
                        {
                            // If there is a selection we extend it using the selection mode
                            // (expand the "end"selection point)
                            _terminal->SetSelectionEnd(terminalPosition, mode);
                        }
                        else
                        {
                            // If there is no selection we establish it using the selected mode
                            // (expand both "start" and "end" selection points)
                            _terminal->MultiClickSelection(terminalPosition, mode);
                        }
                        _selectionNeedsToBeCopied = true;
                    }


Review comment (suggestion):
```suggestion
                    // (we need to reset selection on double-click or triple-click, so it captures the word or the line,
```

Code after:
                }
                else if (multiClickMapper == 3)
                {
                    mode = ::Terminal::SelectionExpansionMode::Line;
                }

                if (ctrlEnabled && multiClickMapper == 1 &&
                    !(_terminal->GetHyperlinkAtPosition(terminalPosition).empty()))
                {
                    _HyperlinkHandler(_terminal->GetHyperlinkAtPosition(terminalPosition));
                }
                else
                {
                    // Update the selection appropriately

                    // Capture the position of the first click when no selection is active
                    if (mode == ::Terminal::SelectionExpansionMode::Cell && !_terminal->IsSelectionActive())
                    {
                        _singleClickTouchdownPos = cursorPosition;
                        _lastMouseClickPosNoSelection = cursorPosition;
                    }

                    // We reset the active selection if one of the conditions apply:
                    // - shift is not held
                    // - GH#9384: the position is the same as of the first click starting the selection
                    // (we need to reset selection on double-click or triple-click, so it captures the word or the line,
                    // rather than extending the selection)
                    if (_terminal->IsSelectionActive() && (!shiftEnabled || _lastMouseClickPosNoSelection == cursorPosition))
                    {
                        // Reset the selection
                        _terminal->ClearSelection();
                        _selectionNeedsToBeCopied = false; // there's no selection, so there's nothing to update
                    }

                    if (shiftEnabled)
                    {
                        if (_terminal->IsSelectionActive())
                        {
                            // If there is a selection we extend it using the selection mode
                            // (expand the "end"selection point)
                            _terminal->SetSelectionEnd(terminalPosition, mode);
                        }
                        else
                        {
                            // If there is no selection we establish it using the selected mode
                            // (expand both "start" and "end" selection points)
                            _terminal->MultiClickSelection(terminalPosition, mode);
                        }
                        _selectionNeedsToBeCopied = true;
                    }