Skip to content
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

Fix click-drag selection on an unfocused Terminal #4506

Merged
8 commits merged into from
Feb 13, 2020

Conversation

leonMSFT
Copy link
Contributor

@leonMSFT leonMSFT commented Feb 7, 2020

Summary of the Pull Request

This PR tries to address some of the weird interactions with pointer pressed events when the Terminal isn't in focus. Here's the four things that have changed as part of this PR;

  1. This PR will allow the user to be able to make a selection with a click-drag without having to first perform a single click on a tab/pane to bring it to focus.
  2. Another weird bug that's fixed in this PR is where trying to make a selection on an unfocused tab when it already has a selection active will simply extend the existing selection instead of making a new one.
  3. Not related to the issue that his PR closes: a right click will now focus the tab/pane.

I've made sure that we still have the existing functionality where a single click on an unfocused tab/pane does not make a single-cell selection and just focuses the tab/pane.

PR Checklist

Validation Steps Performed

Played around with all sorts of selection when in-focus and out of focus with multiple panes and tabs.
Unit tests still pass as well.

@leonMSFT leonMSFT added Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Product-Terminal The new Windows Terminal. labels Feb 7, 2020
@leonMSFT leonMSFT added this to the Terminal v1.0 milestone Feb 7, 2020
@DHowett-MSFT
Copy link
Contributor

Oh no! It looks like the line endings on TerminalControl.cpp got damaged, and github thinks the entire file has changed./

Copy link
Contributor

@DHowett-MSFT DHowett-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this. Do you have an idea how it'll interact with double-click selection? Can you double-click a word in an unfocused terminal and begin a chunked word selection?

@leonMSFT
Copy link
Contributor Author

leonMSFT commented Feb 12, 2020

It won't chunk select if you perform a multi-click. It's because the way it's written now is that unless your first click is part of a click-drag selection, it will always only focus. So, even if you did a double click, the first click is a focus click, and the second click would be a single-character selection click.

I was actually considering whether to also let double click, triple click, and shift-click successfully select from out of focus, but for now I figured it might be simpler to only let the click-drag scenario through.

@DHowett-MSFT
Copy link
Contributor

@carlos-zamora did you have any further concerns on this?

@DHowett-MSFT
Copy link
Contributor

nit: before you merge this (by using the AutoMerge tag), please update the title to..

  1. be "imperative"
  2. be shorter than 72 characters

Pretend the title is the end of the sentence "If merged, this pull request will..."

@DHowett-MSFT
Copy link
Contributor

(If you use the automerge tag, the bot will take the title and body of the PR as the commit title/body)

@leonMSFT leonMSFT changed the title Click-Drag Selection Inconsistencies when Terminal isn't in focus Fix click-drag selection on an unfocused Terminal Feb 13, 2020
@leonMSFT leonMSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Feb 13, 2020
@ghost
Copy link

ghost commented Feb 13, 2020

Hello @leonMSFT!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 7836da0 into master Feb 13, 2020
@ghost ghost deleted the dev/lelian/clickdraginconsistencies branch February 13, 2020 00:32
@ghost
Copy link

ghost commented Feb 13, 2020

🎉Windows Terminal Preview v0.9.433.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) AutoMerge Marked for automatic merge by the bot when requirements are met Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Behaviour of click-and-drag text selection depends inconsistently on prior pane and application focus state
3 participants