fix build (primarily PublicTerminalCore)
This commit is contained in:
parent
a0e4f2dd05
commit
8a646138f4
|
@ -549,11 +549,11 @@ try
|
|||
|
||||
if (multiClickMapper == 3)
|
||||
{
|
||||
_terminal->MultiClickSelection(cursorPosition / fontSize, ::Terminal::SelectionExpansionMode::Line);
|
||||
_terminal->MultiClickSelection(cursorPosition / fontSize, InternalSelectionExpansion::Line);
|
||||
}
|
||||
else if (multiClickMapper == 2)
|
||||
{
|
||||
_terminal->MultiClickSelection(cursorPosition / fontSize, ::Terminal::SelectionExpansionMode::Word);
|
||||
_terminal->MultiClickSelection(cursorPosition / fontSize, InternalSelectionExpansion::Word);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,6 +33,40 @@ constexpr const auto TsfRedrawInterval = std::chrono::milliseconds(100);
|
|||
// The minimum delay between updating the locations of regex patterns
|
||||
constexpr const auto UpdatePatternLocationsInterval = std::chrono::milliseconds(500);
|
||||
|
||||
static constexpr InternalSelectionDirection ConvertToInternalSelectionDirection(winrt::Microsoft::Terminal::Core::SelectionDirection dir)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
default:
|
||||
case winrt::Microsoft::Terminal::Core::SelectionDirection::Left:
|
||||
return InternalSelectionDirection::Left;
|
||||
case winrt::Microsoft::Terminal::Core::SelectionDirection::Right:
|
||||
return InternalSelectionDirection::Right;
|
||||
case winrt::Microsoft::Terminal::Core::SelectionDirection::Up:
|
||||
return InternalSelectionDirection::Up;
|
||||
case winrt::Microsoft::Terminal::Core::SelectionDirection::Down:
|
||||
return InternalSelectionDirection::Down;
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr InternalSelectionExpansion ConvertToInternalSelectionExpansion(winrt::Microsoft::Terminal::Core::SelectionExpansion mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
case winrt::Microsoft::Terminal::Core::SelectionExpansion::Char:
|
||||
return InternalSelectionExpansion::Char;
|
||||
case winrt::Microsoft::Terminal::Core::SelectionExpansion::Word:
|
||||
return InternalSelectionExpansion::Word;
|
||||
case winrt::Microsoft::Terminal::Core::SelectionExpansion::Line:
|
||||
return InternalSelectionExpansion::Line;
|
||||
case winrt::Microsoft::Terminal::Core::SelectionExpansion::Viewport:
|
||||
return InternalSelectionExpansion::Viewport;
|
||||
case winrt::Microsoft::Terminal::Core::SelectionExpansion::Buffer:
|
||||
return InternalSelectionExpansion::Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
// Helper static function to ensure that all ambiguous-width glyphs are reported as narrow.
|
||||
|
@ -937,7 +971,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
}
|
||||
|
||||
auto lock = _terminal->LockForWriting();
|
||||
_terminal->UpdateSelection(direction, mode);
|
||||
_terminal->UpdateSelection(ConvertToInternalSelectionDirection(direction), ConvertToInternalSelectionExpansion(mode));
|
||||
_renderer->TriggerSelection();
|
||||
return true;
|
||||
}
|
||||
|
@ -1470,7 +1504,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
{
|
||||
// If shift is pressed and there is a selection we extend it using
|
||||
// the selection mode (expand the "end" selection point)
|
||||
_terminal->SetSelectionEnd(terminalPosition, mode);
|
||||
_terminal->SetSelectionEnd(terminalPosition, ConvertToInternalSelectionExpansion(mode));
|
||||
selectionNeedsToBeCopied = true;
|
||||
}
|
||||
else if (mode != Core::SelectionExpansion::Char || shiftEnabled)
|
||||
|
@ -1478,7 +1512,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
// If we are handling a double / triple-click or shift+single click
|
||||
// we establish selection using the selected mode
|
||||
// (expand both "start" and "end" selection points)
|
||||
_terminal->MultiClickSelection(terminalPosition, mode);
|
||||
_terminal->MultiClickSelection(terminalPosition, ConvertToInternalSelectionExpansion(mode));
|
||||
selectionNeedsToBeCopied = true;
|
||||
}
|
||||
|
||||
|
@ -1572,5 +1606,4 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||
|
||||
return hstring(ss.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -862,7 +862,7 @@ WORD Terminal::_TakeVirtualKeyFromLastKeyEvent(const WORD scanCode) noexcept
|
|||
return std::unique_lock{ _readWriteLock };
|
||||
}
|
||||
|
||||
Viewport Terminal::_GetMutableViewport() const noexcept
|
||||
Microsoft::Console::Types::Viewport Terminal::_GetMutableViewport() const noexcept
|
||||
{
|
||||
return _mutableViewport;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,23 @@ namespace winrt::Microsoft::Terminal::Core
|
|||
namespace Microsoft::Terminal::Core
|
||||
{
|
||||
class Terminal;
|
||||
|
||||
enum class InternalSelectionDirection
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Up,
|
||||
Down
|
||||
};
|
||||
|
||||
enum class InternalSelectionExpansion
|
||||
{
|
||||
Char,
|
||||
Word,
|
||||
Line, // Mouse selection only! Not a setting!
|
||||
Viewport,
|
||||
Buffer
|
||||
};
|
||||
}
|
||||
|
||||
// fwdecl unittest classes
|
||||
|
@ -227,11 +244,11 @@ public:
|
|||
|
||||
#pragma region TextSelection
|
||||
// These methods are defined in TerminalSelection.cpp
|
||||
void MultiClickSelection(const COORD viewportPos, winrt::Microsoft::Terminal::Core::SelectionExpansion expansionMode);
|
||||
void MultiClickSelection(const COORD viewportPos, InternalSelectionExpansion expansionMode);
|
||||
void SetSelectionAnchor(const COORD position);
|
||||
void SetSelectionEnd(const COORD position, std::optional<winrt::Microsoft::Terminal::Core::SelectionExpansion> newExpansionMode = std::nullopt);
|
||||
void SetSelectionEnd(const COORD position, std::optional<InternalSelectionExpansion> newExpansionMode = std::nullopt);
|
||||
void SetBlockSelection(const bool isEnabled) noexcept;
|
||||
void UpdateSelection(winrt::Microsoft::Terminal::Core::SelectionDirection direction, winrt::Microsoft::Terminal::Core::SelectionExpansion mode);
|
||||
void UpdateSelection(InternalSelectionDirection direction, InternalSelectionExpansion mode);
|
||||
|
||||
const TextBuffer::TextAndColor RetrieveSelectedTextFromBuffer(bool trimTrailingWhitespace);
|
||||
#pragma endregion
|
||||
|
@ -303,7 +320,7 @@ private:
|
|||
std::optional<SelectionAnchors> _selection;
|
||||
bool _blockSelection;
|
||||
std::wstring _wordDelimiters;
|
||||
winrt::Microsoft::Terminal::Core::SelectionExpansion _multiClickSelectionMode;
|
||||
InternalSelectionExpansion _multiClickSelectionMode;
|
||||
#pragma endregion
|
||||
|
||||
// TODO: These members are not shared by an alt-buffer. They should be
|
||||
|
@ -370,10 +387,10 @@ private:
|
|||
std::tuple<COORD, COORD, bool> _PivotSelection(const COORD targetPos) const;
|
||||
std::pair<COORD, COORD> _ExpandSelectionAnchors(std::pair<COORD, COORD> anchors) const;
|
||||
COORD _ConvertToBufferCell(const COORD viewportPos) const;
|
||||
void _MoveByChar(winrt::Microsoft::Terminal::Core::SelectionDirection direction, COORD& pos);
|
||||
void _MoveByWord(winrt::Microsoft::Terminal::Core::SelectionDirection direction, COORD& pos);
|
||||
void _MoveByViewport(winrt::Microsoft::Terminal::Core::SelectionDirection direction, COORD& pos);
|
||||
void _MoveByBuffer(winrt::Microsoft::Terminal::Core::SelectionDirection direction, COORD& pos);
|
||||
void _MoveByChar(InternalSelectionDirection direction, COORD& pos);
|
||||
void _MoveByWord(InternalSelectionDirection direction, COORD& pos);
|
||||
void _MoveByViewport(InternalSelectionDirection direction, COORD& pos);
|
||||
void _MoveByBuffer(InternalSelectionDirection direction, COORD& pos);
|
||||
#pragma endregion
|
||||
|
||||
Microsoft::Console::VirtualTerminal::SgrStack _sgrStack;
|
||||
|
|
|
@ -104,7 +104,7 @@ const bool Terminal::IsBlockSelection() const noexcept
|
|||
// Arguments:
|
||||
// - viewportPos: the (x,y) coordinate on the visible viewport
|
||||
// - expansionMode: the SelectionExpansion to dictate the boundaries of the selection anchors
|
||||
void Terminal::MultiClickSelection(const COORD viewportPos, SelectionExpansion expansionMode)
|
||||
void Terminal::MultiClickSelection(const COORD viewportPos, InternalSelectionExpansion expansionMode)
|
||||
{
|
||||
// set the selection pivot to expand the selection using SetSelectionEnd()
|
||||
_selection = SelectionAnchors{};
|
||||
|
@ -127,7 +127,7 @@ void Terminal::SetSelectionAnchor(const COORD viewportPos)
|
|||
_selection = SelectionAnchors{};
|
||||
_selection->pivot = _ConvertToBufferCell(viewportPos);
|
||||
|
||||
_multiClickSelectionMode = SelectionExpansion::Char;
|
||||
_multiClickSelectionMode = InternalSelectionExpansion::Char;
|
||||
SetSelectionEnd(viewportPos);
|
||||
|
||||
_selection->start = _selection->pivot;
|
||||
|
@ -139,7 +139,7 @@ void Terminal::SetSelectionAnchor(const COORD viewportPos)
|
|||
// Arguments:
|
||||
// - viewportPos: the (x,y) coordinate on the visible viewport
|
||||
// - newExpansionMode: overwrites the _multiClickSelectionMode for this function call. Used for ShiftClick
|
||||
void Terminal::SetSelectionEnd(const COORD viewportPos, std::optional<SelectionExpansion> newExpansionMode)
|
||||
void Terminal::SetSelectionEnd(const COORD viewportPos, std::optional<InternalSelectionExpansion> newExpansionMode)
|
||||
{
|
||||
if (!_selection.has_value())
|
||||
{
|
||||
|
@ -216,15 +216,15 @@ std::pair<COORD, COORD> Terminal::_ExpandSelectionAnchors(std::pair<COORD, COORD
|
|||
const auto bufferSize = _buffer->GetSize();
|
||||
switch (_multiClickSelectionMode)
|
||||
{
|
||||
case SelectionExpansion::Line:
|
||||
case InternalSelectionExpansion::Line:
|
||||
start = { bufferSize.Left(), start.Y };
|
||||
end = { bufferSize.RightInclusive(), end.Y };
|
||||
break;
|
||||
case SelectionExpansion::Word:
|
||||
case InternalSelectionExpansion::Word:
|
||||
start = _buffer->GetWordStart(start, _wordDelimiters);
|
||||
end = _buffer->GetWordEnd(end, _wordDelimiters);
|
||||
break;
|
||||
case SelectionExpansion::Char:
|
||||
case InternalSelectionExpansion::Char:
|
||||
default:
|
||||
// no expansion is necessary
|
||||
break;
|
||||
|
@ -241,7 +241,7 @@ void Terminal::SetBlockSelection(const bool isEnabled) noexcept
|
|||
_blockSelection = isEnabled;
|
||||
}
|
||||
|
||||
void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion mode)
|
||||
void Terminal::UpdateSelection(InternalSelectionDirection direction, InternalSelectionExpansion mode)
|
||||
{
|
||||
// 1. Figure out which endpoint to update
|
||||
// One of the endpoints is the pivot, signifying that the other endpoint is the one we want to move.
|
||||
|
@ -251,16 +251,16 @@ void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion
|
|||
// 2. Perform the movement
|
||||
switch (mode)
|
||||
{
|
||||
case SelectionExpansion::Char:
|
||||
case InternalSelectionExpansion::Char:
|
||||
_MoveByChar(direction, targetPos);
|
||||
break;
|
||||
case SelectionExpansion::Word:
|
||||
case InternalSelectionExpansion::Word:
|
||||
_MoveByWord(direction, targetPos);
|
||||
break;
|
||||
case SelectionExpansion::Viewport:
|
||||
case InternalSelectionExpansion::Viewport:
|
||||
_MoveByViewport(direction, targetPos);
|
||||
break;
|
||||
case SelectionExpansion::Buffer:
|
||||
case InternalSelectionExpansion::Buffer:
|
||||
_MoveByBuffer(direction, targetPos);
|
||||
break;
|
||||
}
|
||||
|
@ -287,25 +287,25 @@ void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion
|
|||
}
|
||||
}
|
||||
|
||||
void Terminal::_MoveByChar(SelectionDirection direction, COORD& pos)
|
||||
void Terminal::_MoveByChar(InternalSelectionDirection direction, COORD& pos)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case SelectionDirection::Left:
|
||||
case InternalSelectionDirection::Left:
|
||||
_buffer->GetSize().DecrementInBounds(pos);
|
||||
pos = _buffer->GetGlyphStart(pos);
|
||||
break;
|
||||
case SelectionDirection::Right:
|
||||
case InternalSelectionDirection::Right:
|
||||
_buffer->GetSize().IncrementInBounds(pos);
|
||||
pos = _buffer->GetGlyphEnd(pos);
|
||||
break;
|
||||
case SelectionDirection::Up:
|
||||
case InternalSelectionDirection::Up:
|
||||
{
|
||||
const auto bufferSize{ _buffer->GetSize() };
|
||||
pos = { pos.X, std::clamp(base::ClampSub<short, short>(pos.Y, 1).RawValue(), bufferSize.Top(), bufferSize.BottomInclusive()) };
|
||||
break;
|
||||
}
|
||||
case SelectionDirection::Down:
|
||||
case InternalSelectionDirection::Down:
|
||||
{
|
||||
const auto bufferSize{ _buffer->GetSize() };
|
||||
pos = { pos.X, std::clamp(base::ClampAdd<short, short>(pos.Y, 1).RawValue(), bufferSize.Top(), bufferSize.BottomInclusive()) };
|
||||
|
@ -314,11 +314,11 @@ void Terminal::_MoveByChar(SelectionDirection direction, COORD& pos)
|
|||
}
|
||||
}
|
||||
|
||||
void Terminal::_MoveByWord(SelectionDirection direction, COORD& pos)
|
||||
void Terminal::_MoveByWord(InternalSelectionDirection direction, COORD& pos)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case SelectionDirection::Left:
|
||||
case InternalSelectionDirection::Left:
|
||||
const auto wordStartPos{ _buffer->GetWordStart(pos, _wordDelimiters) };
|
||||
if (_buffer->GetSize().CompareInBounds(_selection->pivot, pos) < 0)
|
||||
{
|
||||
|
@ -339,7 +339,7 @@ void Terminal::_MoveByWord(SelectionDirection direction, COORD& pos)
|
|||
pos = wordStartPos;
|
||||
}
|
||||
break;
|
||||
case SelectionDirection::Right:
|
||||
case InternalSelectionDirection::Right:
|
||||
const auto wordEndPos{ _buffer->GetWordEnd(pos, _wordDelimiters) };
|
||||
if (_buffer->GetSize().CompareInBounds(pos, _selection->pivot) < 0)
|
||||
{
|
||||
|
@ -360,36 +360,36 @@ void Terminal::_MoveByWord(SelectionDirection direction, COORD& pos)
|
|||
pos = wordEndPos;
|
||||
}
|
||||
break;
|
||||
case SelectionDirection::Up:
|
||||
case InternalSelectionDirection::Up:
|
||||
_MoveByChar(direction, pos);
|
||||
pos = _buffer->GetWordStart(pos, _wordDelimiters);
|
||||
break;
|
||||
case SelectionDirection::Down:
|
||||
case InternalSelectionDirection::Down:
|
||||
_MoveByChar(direction, pos);
|
||||
pos = _buffer->GetWordEnd(pos, _wordDelimiters);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Terminal::_MoveByViewport(SelectionDirection direction, COORD& pos)
|
||||
void Terminal::_MoveByViewport(InternalSelectionDirection direction, COORD& pos)
|
||||
{
|
||||
const auto bufferSize{ _buffer->GetSize() };
|
||||
switch (direction)
|
||||
{
|
||||
case SelectionDirection::Left:
|
||||
case InternalSelectionDirection::Left:
|
||||
pos = { bufferSize.Left(), pos.Y };
|
||||
break;
|
||||
case SelectionDirection::Right:
|
||||
case InternalSelectionDirection::Right:
|
||||
pos = { bufferSize.RightInclusive(), pos.Y };
|
||||
break;
|
||||
case SelectionDirection::Up:
|
||||
case InternalSelectionDirection::Up:
|
||||
{
|
||||
const auto viewportHeight{ _mutableViewport.Height() };
|
||||
const auto newY{ base::ClampSub<short, short>(pos.Y, viewportHeight) };
|
||||
pos = newY < bufferSize.Top() ? bufferSize.Origin() : COORD{ pos.X, newY };
|
||||
break;
|
||||
}
|
||||
case SelectionDirection::Down:
|
||||
case InternalSelectionDirection::Down:
|
||||
{
|
||||
const auto viewportHeight{ _mutableViewport.Height() };
|
||||
const auto mutableBottom{ _mutableViewport.BottomInclusive() };
|
||||
|
@ -400,17 +400,17 @@ void Terminal::_MoveByViewport(SelectionDirection direction, COORD& pos)
|
|||
}
|
||||
}
|
||||
|
||||
void Terminal::_MoveByBuffer(SelectionDirection direction, COORD& pos)
|
||||
void Terminal::_MoveByBuffer(InternalSelectionDirection direction, COORD& pos)
|
||||
{
|
||||
const auto bufferSize{ _buffer->GetSize() };
|
||||
switch (direction)
|
||||
{
|
||||
case SelectionDirection::Left:
|
||||
case SelectionDirection::Up:
|
||||
case InternalSelectionDirection::Left:
|
||||
case InternalSelectionDirection::Up:
|
||||
pos = bufferSize.Origin();
|
||||
break;
|
||||
case SelectionDirection::Right:
|
||||
case SelectionDirection::Down:
|
||||
case InternalSelectionDirection::Right:
|
||||
case InternalSelectionDirection::Down:
|
||||
pos = { bufferSize.RightInclusive(), _mutableViewport.BottomInclusive() };
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ void Terminal::SelectNewRegion(const COORD coordStart, const COORD coordEnd)
|
|||
realCoordEnd.Y -= gsl::narrow<short>(_VisibleStartIndex());
|
||||
|
||||
SetSelectionAnchor(realCoordStart);
|
||||
SetSelectionEnd(realCoordEnd, winrt::Microsoft::Terminal::Core::SelectionExpansion::Char);
|
||||
SetSelectionEnd(realCoordEnd, InternalSelectionExpansion::Char);
|
||||
}
|
||||
|
||||
const std::wstring_view Terminal::GetConsoleTitle() const noexcept
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace TerminalCoreUnitTests
|
|||
DummyRenderTarget emptyRT;
|
||||
term.Create({ 10, 10 }, scrollback, emptyRT);
|
||||
|
||||
term.MultiClickSelection(maxCoord, SelectionExpansion::Word);
|
||||
term.MultiClickSelection(maxCoord, InternalSelectionExpansion::Word);
|
||||
ValidateSingleRowSelection(term, expected);
|
||||
};
|
||||
|
||||
|
@ -142,7 +142,7 @@ namespace TerminalCoreUnitTests
|
|||
DummyRenderTarget emptyRT;
|
||||
term.Create({ 10, 10 }, scrollback, emptyRT);
|
||||
|
||||
term.MultiClickSelection(maxCoord, SelectionExpansion::Line);
|
||||
term.MultiClickSelection(maxCoord, InternalSelectionExpansion::Line);
|
||||
ValidateSingleRowSelection(term, expected);
|
||||
};
|
||||
|
||||
|
@ -501,7 +501,7 @@ namespace TerminalCoreUnitTests
|
|||
|
||||
// Simulate double click at (x,y) = (5,10)
|
||||
auto clickPos = COORD{ 5, 10 };
|
||||
term.MultiClickSelection(clickPos, SelectionExpansion::Word);
|
||||
term.MultiClickSelection(clickPos, InternalSelectionExpansion::Word);
|
||||
|
||||
// Validate selection area
|
||||
ValidateSingleRowSelection(term, SMALL_RECT({ 4, 10, (4 + gsl::narrow<SHORT>(text.size()) - 1), 10 }));
|
||||
|
@ -519,7 +519,7 @@ namespace TerminalCoreUnitTests
|
|||
|
||||
// Simulate click at (x,y) = (5,10)
|
||||
auto clickPos = COORD{ 5, 10 };
|
||||
term.MultiClickSelection(clickPos, SelectionExpansion::Word);
|
||||
term.MultiClickSelection(clickPos, InternalSelectionExpansion::Word);
|
||||
|
||||
// Simulate renderer calling TriggerSelection and acquiring selection area
|
||||
auto selectionRects = term.GetSelectionRects();
|
||||
|
@ -546,7 +546,7 @@ namespace TerminalCoreUnitTests
|
|||
// Simulate click at (x,y) = (15,10)
|
||||
// this is over the '>' char
|
||||
auto clickPos = COORD{ 15, 10 };
|
||||
term.MultiClickSelection(clickPos, SelectionExpansion::Word);
|
||||
term.MultiClickSelection(clickPos, InternalSelectionExpansion::Word);
|
||||
|
||||
// ---Validate selection area---
|
||||
// "Terminal" is in class 2
|
||||
|
@ -572,7 +572,7 @@ namespace TerminalCoreUnitTests
|
|||
term.Write(text);
|
||||
|
||||
// Simulate double click at (x,y) = (5,10)
|
||||
term.MultiClickSelection({ 5, 10 }, SelectionExpansion::Word);
|
||||
term.MultiClickSelection({ 5, 10 }, InternalSelectionExpansion::Word);
|
||||
|
||||
// Simulate move to (x,y) = (21,10)
|
||||
//
|
||||
|
@ -601,7 +601,7 @@ namespace TerminalCoreUnitTests
|
|||
term.Write(text);
|
||||
|
||||
// Simulate double click at (x,y) = (21,10)
|
||||
term.MultiClickSelection({ 21, 10 }, SelectionExpansion::Word);
|
||||
term.MultiClickSelection({ 21, 10 }, InternalSelectionExpansion::Word);
|
||||
|
||||
// Simulate move to (x,y) = (5,10)
|
||||
//
|
||||
|
@ -622,7 +622,7 @@ namespace TerminalCoreUnitTests
|
|||
|
||||
// Simulate click at (x,y) = (5,10)
|
||||
auto clickPos = COORD{ 5, 10 };
|
||||
term.MultiClickSelection(clickPos, SelectionExpansion::Line);
|
||||
term.MultiClickSelection(clickPos, InternalSelectionExpansion::Line);
|
||||
|
||||
// Validate selection area
|
||||
ValidateSingleRowSelection(term, SMALL_RECT({ 0, 10, 99, 10 }));
|
||||
|
@ -636,7 +636,7 @@ namespace TerminalCoreUnitTests
|
|||
|
||||
// Simulate click at (x,y) = (5,10)
|
||||
auto clickPos = COORD{ 5, 10 };
|
||||
term.MultiClickSelection(clickPos, SelectionExpansion::Line);
|
||||
term.MultiClickSelection(clickPos, InternalSelectionExpansion::Line);
|
||||
|
||||
// Simulate move to (x,y) = (7,10)
|
||||
term.SetSelectionEnd({ 7, 10 });
|
||||
|
@ -653,7 +653,7 @@ namespace TerminalCoreUnitTests
|
|||
|
||||
// Simulate click at (x,y) = (5,10)
|
||||
auto clickPos = COORD{ 5, 10 };
|
||||
term.MultiClickSelection(clickPos, SelectionExpansion::Line);
|
||||
term.MultiClickSelection(clickPos, InternalSelectionExpansion::Line);
|
||||
|
||||
// Simulate move to (x,y) = (5,11)
|
||||
term.SetSelectionEnd({ 5, 11 });
|
||||
|
@ -691,7 +691,7 @@ namespace TerminalCoreUnitTests
|
|||
// Step 1: Create a selection on "doubleClickMe"
|
||||
{
|
||||
// Simulate double click at (x,y) = (5,10)
|
||||
term.MultiClickSelection({ 5, 10 }, SelectionExpansion::Word);
|
||||
term.MultiClickSelection({ 5, 10 }, InternalSelectionExpansion::Word);
|
||||
|
||||
// Validate selection area: "doubleClickMe" selected
|
||||
ValidateSingleRowSelection(term, SMALL_RECT({ 4, 10, 16, 10 }));
|
||||
|
@ -704,7 +704,7 @@ namespace TerminalCoreUnitTests
|
|||
// buffer: doubleClickMe dragThroughHere
|
||||
// ^ ^
|
||||
// start finish
|
||||
term.SetSelectionEnd({ 21, 10 }, SelectionExpansion::Char);
|
||||
term.SetSelectionEnd({ 21, 10 }, InternalSelectionExpansion::Char);
|
||||
|
||||
// Validate selection area: "doubleClickMe drag" selected
|
||||
ValidateSingleRowSelection(term, SMALL_RECT({ 4, 10, 21, 10 }));
|
||||
|
@ -717,7 +717,7 @@ namespace TerminalCoreUnitTests
|
|||
// buffer: doubleClickMe dragThroughHere
|
||||
// ^ ^ ^
|
||||
// start click finish
|
||||
term.SetSelectionEnd({ 21, 10 }, SelectionExpansion::Word);
|
||||
term.SetSelectionEnd({ 21, 10 }, InternalSelectionExpansion::Word);
|
||||
|
||||
// Validate selection area: "doubleClickMe dragThroughHere" selected
|
||||
ValidateSingleRowSelection(term, SMALL_RECT({ 4, 10, 32, 10 }));
|
||||
|
@ -730,7 +730,7 @@ namespace TerminalCoreUnitTests
|
|||
// buffer: doubleClickMe dragThroughHere |
|
||||
// ^ ^ ^
|
||||
// start click finish (boundary)
|
||||
term.SetSelectionEnd({ 21, 10 }, SelectionExpansion::Line);
|
||||
term.SetSelectionEnd({ 21, 10 }, InternalSelectionExpansion::Line);
|
||||
|
||||
// Validate selection area: "doubleClickMe dragThroughHere..." selected
|
||||
ValidateSingleRowSelection(term, SMALL_RECT({ 4, 10, 99, 10 }));
|
||||
|
@ -743,7 +743,7 @@ namespace TerminalCoreUnitTests
|
|||
// buffer: doubleClickMe dragThroughHere
|
||||
// ^ ^ ^
|
||||
// start click finish
|
||||
term.SetSelectionEnd({ 21, 10 }, SelectionExpansion::Word);
|
||||
term.SetSelectionEnd({ 21, 10 }, InternalSelectionExpansion::Word);
|
||||
|
||||
// Validate selection area: "doubleClickMe dragThroughHere" selected
|
||||
ValidateSingleRowSelection(term, SMALL_RECT({ 4, 10, 32, 10 }));
|
||||
|
@ -825,7 +825,7 @@ namespace TerminalCoreUnitTests
|
|||
|
||||
// Step 4: Shift+Click at (5,10)
|
||||
{
|
||||
term.SetSelectionEnd({ 5, 10 }, SelectionExpansion::Char);
|
||||
term.SetSelectionEnd({ 5, 10 }, InternalSelectionExpansion::Char);
|
||||
|
||||
// Validate selection area
|
||||
// NOTE: Pivot should still be (10, 10)
|
||||
|
@ -834,7 +834,7 @@ namespace TerminalCoreUnitTests
|
|||
|
||||
// Step 5: Shift+Click back at (20,10)
|
||||
{
|
||||
term.SetSelectionEnd({ 20, 10 }, SelectionExpansion::Char);
|
||||
term.SetSelectionEnd({ 20, 10 }, InternalSelectionExpansion::Char);
|
||||
|
||||
// Validate selection area
|
||||
// NOTE: Pivot should still be (10, 10)
|
||||
|
|
Loading…
Reference in a new issue