Skip to content

Commit

Permalink
shouldMoveCursor --> shouldMoveBothEndpoints; _anchorSelectionEndpoin…
Browse files Browse the repository at this point in the history
…t --> anchorInactiveSelectionEndpoint
  • Loading branch information
carlos-zamora committed Jun 30, 2022
1 parent 22dac66 commit 02d6a07
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Terminal::Terminal() :
_selectionMode{ SelectionInteractionMode::None },
_selection{ std::nullopt },
_selectionEndpoint{ static_cast<SelectionEndpoint>(0) },
_anchorSelectionEndpoint{ false },
_anchorInactiveSelectionEndpoint{ false },
_taskbarState{ 0 },
_taskbarProgress{ 0 },
_trimBlockSelection{ false },
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class Microsoft::Terminal::Core::Terminal final :
SelectionExpansion _multiClickSelectionMode;
SelectionInteractionMode _selectionMode;
SelectionEndpoint _selectionEndpoint;
bool _anchorSelectionEndpoint;
bool _anchorInactiveSelectionEndpoint;
#pragma endregion

std::unique_ptr<TextBuffer> _mainBuffer;
Expand Down
10 changes: 5 additions & 5 deletions src/cascadia/TerminalCore/TerminalSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void Terminal::SwitchSelectionEndpoint()
{
// moving cursor --> anchor start, move end
_selectionEndpoint = SelectionEndpoint::End;
_anchorSelectionEndpoint = true;
_anchorInactiveSelectionEndpoint = true;
}
else if (WI_IsFlagSet(_selectionEndpoint, SelectionEndpoint::End))
{
Expand Down Expand Up @@ -396,7 +396,7 @@ void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion
// We have special functionality where if you use the "switchSelectionEndpoint" action
// when in mark mode (moving the cursor), we anchor an endpoint and you can use the
// plain arrow keys to move the endpoint. This way, you don't have to hold shift anymore!
const bool shouldMoveCursor = _selectionMode == SelectionInteractionMode::Mark && !_anchorSelectionEndpoint && !mods.IsShiftPressed();
const bool shouldMoveBothEndpoints = _selectionMode == SelectionInteractionMode::Mark && !_anchorInactiveSelectionEndpoint && !mods.IsShiftPressed();

// 1. Figure out which endpoint to update
// [Mark Mode]
Expand All @@ -405,7 +405,7 @@ void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion
// [Quick Edit]
// - just move "end" (or "start" if "pivot" == "end")
_selectionEndpoint = static_cast<SelectionEndpoint>(0);
if (shouldMoveCursor)
if (shouldMoveBothEndpoints)
{
WI_SetAllFlags(_selectionEndpoint, SelectionEndpoint::Start | SelectionEndpoint::End);
}
Expand Down Expand Up @@ -438,7 +438,7 @@ void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion

// 3. Actually modify the selection state
_selectionMode = std::max(_selectionMode, SelectionInteractionMode::Keyboard);
if (shouldMoveCursor)
if (shouldMoveBothEndpoints)
{
// [Mark Mode] + shift unpressed --> move all three (i.e. just use arrow keys)
_selection->start = targetPos;
Expand Down Expand Up @@ -631,7 +631,7 @@ void Terminal::ClearSelection()
_selection = std::nullopt;
_selectionMode = SelectionInteractionMode::None;
_selectionEndpoint = static_cast<SelectionEndpoint>(0);
_anchorSelectionEndpoint = false;
_anchorInactiveSelectionEndpoint = false;
}

// Method Description:
Expand Down

0 comments on commit 02d6a07

Please sign in to comment.