-
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
Add selection marker overlays for keyboard selection #10865
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
5b4dd33
to
b2a7a19
Compare
5297b80
to
0cc9bd0
Compare
e498dea
to
118d1cd
Compare
2c52439
to
ad26780
Compare
ad26780
to
25d14ae
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Finished rebasing the PR! 🎉 EDIT: things to do...
|
25d14ae
to
85dafbb
Compare
85dafbb
to
214d3af
Compare
@@ -318,10 +343,9 @@ Terminal::UpdateSelectionParams Terminal::ConvertKeyEventToUpdateSelectionParams | |||
void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion mode, ControlKeyStates mods) |
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.
Changes to this function may seem a little odd and unrelated, but they're necessary. Now that we're displaying the relevant y-beam end based on which endpoint we're moving, we need to make sure we're moving the correct one. Before, we could cheat it a bit since we didn't really have a concept of "start" and "end" (more just point 1 and 2).
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.
oh this is much easier to read
A few things I want to highlight (heh)...
|
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.
this sparks joy
@@ -1052,7 +1047,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |||
if (_terminal->IsSelectionActive()) | |||
{ | |||
_terminal->SetBlockSelection(!_terminal->IsBlockSelection()); |
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.
idle thought: maybe we file a follow up to change the shape of the markers when we're in block selection mode? idk.
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.
Oh yeah. Dustin and I were chatting about that the other day. it would be cool if we used some kind of 'L' shape for that.
Definitely a follow-up and something to mention/show in the spec.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
@@ -1012,7 +1038,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |||
{ | |||
auto lock = _terminal->LockForWriting(); | |||
_terminal->SelectAll(); | |||
_renderer->TriggerSelection(); | |||
_updateSelection(false); |
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.
I'm not too sure I like this actually! I can't divine rhyme or reason as to why we would clear sometimes and not others. Is there a guiding principle you're using?
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.
yeah, the general intent is...
- are you using your keyboard? --> show markers
- using a mouse? --> clear markers
- search? --> clear
- toggle block selection? --> probably don't mess with it? (I'm adding this in the next commit)
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
Additional notes from bug bash
|
Did a perf trace in VS. It doesn't even appear in the call tree. Relevant changes are here. Looks like the scale transform is cheap. NOTE: later iteration adds dpi scaling, which is hardly different tbh. That's the one I profiled. |
This comment was marked as resolved.
This comment was marked as resolved.
@DHowett this is ready for review now :) |
This comment was marked as resolved.
This comment was marked as resolved.
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
Summary of the Pull Request
This introduces a selection marker overlay that tells the user which endpoint is currently being moved by the keyboard. The selection markers are respect font size changes and
cursor
color.References
#715 - Keyboard Selection
#2840 - Keyboard Selection Spec
#5804 - Mark Mode Spec
Detailed Description of the Pull Request / Additional comments
TermControl
layer:UpdateSelectionMarkersEventArgs
lets us distinguish between mouse and keyboard selections.ClearMarkers
is set to true in the following cases...LeftClickOnTerminal
, pretty self-explanatoryControlCore
layer:TermControl
to update the selection markers when a selection has changed.TerminalCore
layer:Validation Steps Performed