Skip to content

Commit

Permalink
simplify logic a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Jun 3, 2022
1 parent 76e77de commit 214d3af
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/cascadia/TerminalCore/TerminalSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,26 +366,17 @@ void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion
}

// 3. Actually modify the selection
// NOTE: targetStart doesn't matter here
if (_markMode)
if (_markMode && !mods.IsShiftPressed())
{
// [Mark Mode]
// - shift --> updating a standard selection
// - !shift --> move all three (i.e. just use arrow keys)
if (mods.IsShiftPressed())
{
auto targetStart = false;
std::tie(_selection->start, _selection->end) = _PivotSelection(targetPos, targetStart);
}
else
{
_selection->start = targetPos;
_selection->end = targetPos;
_selection->pivot = targetPos;
}
// [Mark Mode] + shift unpressed --> move all three (i.e. just use arrow keys)
_selection->start = targetPos;
_selection->end = targetPos;
_selection->pivot = targetPos;
}
else
{
// [Mark Mode] + shift --> updating a standard selection
// NOTE: targetStart doesn't matter here
auto targetStart = false;
std::tie(_selection->start, _selection->end) = _PivotSelection(targetPos, targetStart);
}
Expand Down

0 comments on commit 214d3af

Please sign in to comment.