-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take wrapping into account when expanding wordwise selections #17170
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ mnt | |
mru | ||
nje | ||
noreply | ||
notwrapped | ||
ogonek | ||
ok'd | ||
overlined | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2336,16 +2336,32 @@ void TextBufferTests::GetWordBoundaries() | |||
} | ||||
|
||||
_buffer->Reset(); | ||||
_buffer->ResizeTraditional({ 10, 5 }); | ||||
_buffer->ResizeTraditional({ 10, 6 }); | ||||
const std::vector<std::wstring> secondText = { L"this wordiswrapped", | ||||
L"notwrapped" | ||||
|
||||
L"spaces wrapped reachEOB" }; | ||||
//Buffer looks like: | ||||
// this wordi | ||||
// swrapped | ||||
// spaces | ||||
// wrappe | ||||
// d reachEOB | ||||
|
||||
WriteLinesToBuffer(secondText, *_buffer); | ||||
|
||||
//Buffer looks like: | ||||
// 0123456789 | ||||
// 0|this wordi| < wrapped | ||||
// 1|swrapped | < not wrapped | ||||
// 2|notwrapped| < not wrapped | ||||
|
||||
// 3|spaces | < wrapped | ||||
// 4| wrappe| < wrapped | ||||
// 5|d reachEOB| < wrapped | ||||
|
||||
VERIFY_IS_TRUE(_buffer->GetRowByOffset(0).WasWrapForced()); | ||||
VERIFY_IS_FALSE(_buffer->GetRowByOffset(1).WasWrapForced()); | ||||
// GH#780 See the comment in WriteLinesToBuffer | ||||
// VERIFY_IS_FALSE(_buffer->GetRowByOffset(2).WasWrapForced()); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
dead code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, pertinent to the comment above it |
||||
_buffer->GetMutableRowByOffset(2).SetWrapForced(false); // Ugh | ||||
VERIFY_IS_TRUE(_buffer->GetRowByOffset(3).WasWrapForced()); | ||||
VERIFY_IS_TRUE(_buffer->GetRowByOffset(4).WasWrapForced()); | ||||
VERIFY_IS_TRUE(_buffer->GetRowByOffset(5).WasWrapForced()); | ||||
|
||||
// clang-format off | ||||
testData = { | ||||
{ { 0, 0 }, { { 0, 0 }, { 0, 0 } } }, | ||||
{ { 1, 0 }, { { 0, 0 }, { 0, 0 } } }, | ||||
|
@@ -2358,15 +2374,18 @@ void TextBufferTests::GetWordBoundaries() | |||
{ { 9, 1 }, { { 8, 1 }, { 5, 0 } } }, | ||||
|
||||
{ { 0, 2 }, { { 0, 2 }, { 0, 2 } } }, | ||||
{ { 7, 2 }, { { 6, 2 }, { 0, 2 } } }, | ||||
|
||||
{ { 1, 3 }, { { 0, 3 }, { 0, 2 } } }, | ||||
{ { 4, 3 }, { { 4, 3 }, { 4, 3 } } }, | ||||
{ { 8, 3 }, { { 4, 3 }, { 4, 3 } } }, | ||||
|
||||
{ { 0, 4 }, { { 4, 3 }, { 4, 3 } } }, | ||||
{ { 1, 4 }, { { 1, 4 }, { 4, 3 } } }, | ||||
{ { 9, 4 }, { { 2, 4 }, { 2, 4 } } }, | ||||
{ { 9, 2 }, { { 0, 2 }, { 0, 2 } } }, | ||||
// v accessibility does not consider wrapping | ||||
{ { 0, 3 }, { { 0, 3 }, { 0, 2 } } }, | ||||
{ { 7, 3 }, { { 6, 3 }, { 0, 2 } } }, | ||||
// v accessibility does not consider wrapping | ||||
{ { 1, 4 }, { { 0, 4 }, { 0, 2 } } }, | ||||
{ { 4, 4 }, { { 4, 4 }, { 4, 4 } } }, | ||||
{ { 8, 4 }, { { 4, 4 }, { 4, 4 } } }, | ||||
|
||||
{ { 0, 5 }, { { 4, 4 }, { 4, 4 } } }, | ||||
{ { 1, 5 }, { { 1, 5 }, { 4, 4 } } }, | ||||
{ { 9, 5 }, { { 2, 5 }, { 2, 5 } } }, | ||||
}; | ||||
for (const auto& test : testData) | ||||
{ | ||||
|
@@ -2377,12 +2396,15 @@ void TextBufferTests::GetWordBoundaries() | |||
} | ||||
|
||||
//GetWordEnd for Wrapping Text | ||||
//Buffer looks like: | ||||
// this wordi | ||||
// swrapped | ||||
// spaces | ||||
// wrappe | ||||
// d reachEOB | ||||
// Buffer: | ||||
// 0123456789 | ||||
// 0|this wordi| < wrapped | ||||
// 1|swrapped | < not wrapped | ||||
// 2|notwrapped| < not wrapped | ||||
|
||||
// 3|spaces | < wrapped | ||||
// 4| wrappe| < wrapped | ||||
// 5|d reachEOB| < wrapped | ||||
// clang-format off | ||||
testData = { | ||||
// tests for first line of text | ||||
{ { 0, 0 }, { { 3, 0 }, { 5, 0 } } }, | ||||
|
@@ -2395,17 +2417,20 @@ void TextBufferTests::GetWordBoundaries() | |||
{ { 7, 1 }, { { 7, 1 }, { 0, 2 } } }, | ||||
{ { 9, 1 }, { { 9, 1 }, { 0, 2 } } }, | ||||
|
||||
{ { 0, 2 }, { { 5, 2 }, { 4, 3 } } }, | ||||
{ { 7, 2 }, { { 9, 2 }, { 4, 3 } } }, | ||||
{ { 0, 2 }, { { 9, 2 }, { 4, 4 } } }, | ||||
{ { 9, 2 }, { { 9, 2 }, { 4, 4 } } }, | ||||
|
||||
{ { 0, 3 }, { { 5, 3 }, { 4, 4 } } }, | ||||
{ { 7, 3 }, { { 9, 3 }, { 4, 4 } } }, | ||||
|
||||
{ { 1, 3 }, { { 3, 3 }, { 4, 3 } } }, | ||||
{ { 4, 3 }, { { 0, 4 }, { 2, 4 } } }, | ||||
{ { 8, 3 }, { { 0, 4 }, { 2, 4 } } }, | ||||
{ { 1, 4 }, { { 3, 4 }, { 4, 4 } } }, | ||||
{ { 4, 4 }, { { 0, 5 }, { 2, 5 } } }, | ||||
{ { 8, 4 }, { { 0, 5 }, { 2, 5 } } }, | ||||
|
||||
{ { 0, 4 }, { { 0, 4 }, { 2, 4 } } }, | ||||
{ { 1, 4 }, { { 1, 4 }, { 2, 4 } } }, | ||||
{ { 4, 4 }, { { 9, 4 }, { 0, 5 } } }, | ||||
{ { 9, 4 }, { { 9, 4 }, { 0, 5 } } }, | ||||
{ { 0, 5 }, { { 0, 5 }, { 2, 5 } } }, | ||||
{ { 1, 5 }, { { 1, 5 }, { 2, 5 } } }, | ||||
{ { 4, 5 }, { { 9, 5 }, { 0, 6 } } }, | ||||
{ { 9, 5 }, { { 9, 5 }, { 0, 6 } } }, | ||||
}; | ||||
// clang-format on | ||||
|
||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...but should we? If I print
a b
and it force-wraps in the middle, shouldn't I be able to select all 4 spaces with a double click?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, I didn't want to revisit too many of the decisions from the previous code.
But also, this is what prevents us from selecting the entire text buffer when you double-click an empty space lmao