Skip to content

Commit d2f977a

Browse files
mark mode: begin selection at viewport when scrolled up (#19549)
## Summary of the Pull Request Updates mark mode so that it starts at the viewport's origin (top-left) if we're not scrolled to the bottom. This is based on the discussion in #19488. ## Validation Steps Performed ✅ scrolled at bottom --> mark mode starts at cursor ✅ scrolled up --> mark mode starts at cursor Closes #19488
1 parent 965a121 commit d2f977a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cascadia/TerminalCore/TerminalSelection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,10 @@ void Terminal::ToggleMarkMode()
364364
// NOTE: directly set cursor state. We already should have locked before calling this function.
365365
if (!IsSelectionActive())
366366
{
367-
// No selection --> start one at the cursor
368-
const auto cursorPos{ _activeBuffer().GetCursor().GetPosition() };
367+
// If we're scrolled up, use the viewport origin as the selection start.
368+
// Otherwise, use the cursor position.
369+
const auto cursorPos = _scrollOffset != 0 ? _GetVisibleViewport().Origin() :
370+
_activeBuffer().GetCursor().GetPosition();
369371
*_selection.write() = SelectionInfo{
370372
.start = cursorPos,
371373
.end = cursorPos,

0 commit comments

Comments
 (0)