Fix repositioning with the cursor, again (#17141)

This shouldn't have ever worked...? This looks like it was a typo and
should have been `mark.end`.

Thanks @joadoumie for asking about the moving the cursor in the prompt,
that convo lead to me finding this.
This commit is contained in:
Mike Griese 2024-04-26 14:23:39 -07:00 committed by GitHub
parent 41bb28c46d
commit d14ff939dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 82 additions and 76 deletions

View File

@ -2008,6 +2008,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
selectionNeedsToBeCopied = true;
}
else if (_settings->RepositionCursorWithMouse()) // This is also mode==Char && !shiftEnabled
{
_repositionCursorWithMouse(terminalPosition);
}
_updateSelectionUI();
}
void ControlCore::_repositionCursorWithMouse(const til::point terminalPosition)
{
// If we're handling a single left click, without shift pressed, and
// outside mouse mode, AND the user has RepositionCursorWithMouse turned
@ -2054,7 +2061,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// Limit the click to 1 past the last character on the last line.
const auto clampedClick = std::min(bufferPos, lastNonSpace);
if (clampedClick >= end)
if (clampedClick >= last.end)
{
// Get the distance between the cursor and the click, in cells.
@ -2095,8 +2102,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
}
}
_updateSelectionUI();
}
// Method Description:
// - Updates the renderer's representation of the selection as well as the selection marker overlay in TermControl

View File

@ -403,6 +403,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void _focusChanged(bool focused);
void _selectSpan(til::point_span s);
void _repositionCursorWithMouse(const til::point terminalPosition);
void _contextMenuSelectMark(
const til::point& pos,