Skip to content

Commit

Permalink
Add testing for Compare, CompareEndpoint, Expand, and MoveEndpointByR…
Browse files Browse the repository at this point in the history
…ange

Missing tests for...
- GetText
- Move
- MoveEndpointByUnit
Still need to think of how to approach Move and MoveEndpointByUnit since these should be very similar and should reuse a lot of code.
  • Loading branch information
Carlos Zamora authored and carlos-zamora committed Jan 17, 2020
1 parent 9a40869 commit ea22c8f
Show file tree
Hide file tree
Showing 3 changed files with 412 additions and 89 deletions.
40 changes: 20 additions & 20 deletions src/buffer/out/textBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ Microsoft::Console::Render::IRenderTarget& TextBuffer::GetRenderTarget() noexcep
// - accessibilityMode - when enabled, we continue expanding left until we are at the beginning of a readable word
// Return Value:
// - The COORD for the first character on the "word" (inclusive)
const COORD TextBuffer::GetWordStart(const COORD target, const std::wstring_view wordDelimiters, bool accessibilityMode) const
const COORD TextBuffer::GetWordStart(const COORD target, const std::wstring_view wordDelimiters, bool /*accessibilityMode*/) const
{
const auto bufferSize = GetSize();
COORD result = target;
Expand All @@ -978,25 +978,25 @@ const COORD TextBuffer::GetWordStart(const COORD target, const std::wstring_view
--bufferIterator;
}

if (accessibilityMode)
{
// make sure we expand to the beggining of the word
if (_GetDelimiterClass(*bufferIterator, wordDelimiters) == DelimiterClass::RegularChar)
{
while (result.X > bufferSize.Left() && (_GetDelimiterClass(*bufferIterator, wordDelimiters) == DelimiterClass::RegularChar))
{
bufferSize.DecrementInBounds(result);
--bufferIterator;
}
}

// move back onto word start
if (result.X != bufferSize.Left() && _GetDelimiterClass(*bufferIterator, wordDelimiters) != DelimiterClass::RegularChar)
{
bufferSize.IncrementInBounds(result);
}
}
else if (_GetDelimiterClass(*bufferIterator, wordDelimiters) != initialDelimiter)
//if (accessibilityMode)
//{
// // make sure we expand to the beggining of the word
// if (_GetDelimiterClass(*bufferIterator, wordDelimiters) == DelimiterClass::RegularChar)
// {
// while (result.X > bufferSize.Left() && (_GetDelimiterClass(*bufferIterator, wordDelimiters) == DelimiterClass::RegularChar))
// {
// bufferSize.DecrementInBounds(result);
// --bufferIterator;
// }
// }

// // move back onto word start
// if (result.X != bufferSize.Left() && _GetDelimiterClass(*bufferIterator, wordDelimiters) != DelimiterClass::RegularChar)
// {
// bufferSize.IncrementInBounds(result);
// }
//}
if (_GetDelimiterClass(*bufferIterator, wordDelimiters) != initialDelimiter)
{
// move off of delimiter
bufferSize.IncrementInBounds(result);
Expand Down
Loading

0 comments on commit ea22c8f

Please sign in to comment.