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

[ui] Difficult to get rid of selection area #4477

Closed
vadimkantorov opened this issue Feb 5, 2020 · 16 comments · Fixed by #5096
Closed

[ui] Difficult to get rid of selection area #4477

vadimkantorov opened this issue Feb 5, 2020 · 16 comments · Fixed by #5096
Labels
Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@vadimkantorov
Copy link

vadimkantorov commented Feb 5, 2020

In Ubuntu Terminal selection caret is not the default mode. In Windows Terminal it is hard to get rid of selection mode. Even mouse clicking away on empty area preserves it (right mouse click or Esc does the trick, but we don't need these tricks in other applications or terminals). In many terminals a single clicking is not enough to turn on selection and snapping is needed.

image

Strangely, hitting Ctrl+Shift+C removes selection area after copying to clipboard. This is quite annoying, since often we want to preserve the selected area (for copying again later or checking what exactly was being copied)

(Also having a typing caret and selection area active at the same time is strange, e.g. in Chrome in text fields it is not like that, though this is less critical)

Original umbrella issue: #2209

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 5, 2020
@LuanVSO
Copy link
Contributor

LuanVSO commented Feb 5, 2020

right clicking removes the selection because it is copied to the clipboard.

Strangely, hitting Ctrl+Shift+C removes selection area after copying to clipboard. This is quite annoying, since often we want to preserve the selected area (for copying again later or checking what exactly was being copied)

since windows 10 v1809 windows include a clipboard history ui which can be opened with the key combination: win+v

@LuanVSO
Copy link
Contributor

LuanVSO commented Feb 10, 2020

i think #4404 close this

@DHowett-MSFT
Copy link
Contributor

I hope so. 😄

@vadimkantorov
Copy link
Author

vadimkantorov commented Feb 11, 2020

#4404 is about extending selection area and discarding selection area on ESC (discarding selection area on ESC already happens though) and some Shift-Click combo.

My issue is about the fact that a single mouse click causes selection always (which is not how it works in text editors or other terminals except cmd?). I propose that mouse click causes selection only when mosue is dragged/snapped after a click and not starting selection on a single mouse click.

@ahedderich
Copy link

I agree that this is one of the most annoying things about windows terminal. maybe a new settings-option could be implemented to deactivate this behavior.
#4404 is unrelated here.

@DHowett-MSFT
Copy link
Contributor

Yeah, I have never loved the fact that you can select a single cell in the console. Some people love it, though, and every time we try to take it from them they riot. I wish I were kidding ☹️ . What are they going to do, copy a c to their clipboards? I dunno.

To that end, we coupled a "fix" for it in with people who opt for a more xterm-like experience by enabling copyOnSelect.

Is that an acceptable solution? We're trying to bridge the gap between what Windows users expect and what non-windows users might want.

@DHowett-MSFT DHowett-MSFT added Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Product-Terminal The new Windows Terminal. labels Feb 14, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Feb 14, 2020
@ahedderich
Copy link

ahedderich commented Feb 14, 2020

The copyOnSelect option is already a very good start. Without it in the beginning it was a real pain to use.
Unfortunately it's not the final solution. What happens to me often during a day is, that i copy some command from somewhere maybe even the terminal itself and then click for whatever reason once in the terminal window, hit right click and gone is my previous clipboard.
As @vadimkantorov wrote there should be an option to enable selectOnlyOnDrag (or maybe something better named).
So if you just click somewhere nothing happens or the current selection is discarded, if you click and drag you select.
It's not a ground breaking feature but right now it feels like copy and pasting in windows terminal is like balancing a very full coffee mug. Sure, it's doable but you have to pay extra attention not to mess it up.

PS: A welcome side effect of this option if possible could also be the enabling of selection in an unfocused terminal window.
Use case: You write a documentation and you want to copy some commands that you tested in terminal into your editor.

  • So the editor is active
  • You click and drag on the inactive terminal window
  • My expectation would be to select something ready to copy. Right now only the focus shifts to the terminal window. Nothing is selected. You have to release the mouse click start selecting again.

This behavior is great in the current state where you select things by accident but with selectOnlyOnDrag enabled the terminal could also allow selection while getting focus.
This is a really minor thing so i wouldn't open a new issue for that.

@vadimkantorov
Copy link
Author

Also, like in ReSharper / VS, maybe some presets in Configuration would be good: "xterm" / "Gnome Terminal" / "cmd" could be introduced, so that it's super easy to set all options at once. And maybe it could be asked at first run. But of course, for the narrative "Windows is better Linux distro than Mac OS X", Linux/Mac typical terminal behaviors by defautl are nicer than cmd ones.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Feb 14, 2020
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Mar 6, 2020
@DHowett-MSFT DHowett-MSFT added this to the Terminal v1.x milestone Mar 6, 2020
@DHowett-MSFT DHowett-MSFT added Help Wanted We encourage anyone to jump in on these. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Mar 6, 2020
@DHowett-MSFT
Copy link
Contributor

I honestly have never seen the value in being able to have a single-character selection. If we could build enough momentum around getting rid of that (why would you want to copy just a single character? even if so, click-drag-return to first cell would do it) would that be acceptable?

@DHowett-MSFT DHowett-MSFT added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 6, 2020
@vadimkantorov
Copy link
Author

In wsltty one can select a single character even without “going back”, but it still requires some “snapping/dragging”, so that a single character selection (and any selection never happens at random). Same is true for other text editors like notepad or google docs

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 6, 2020
@ahedderich
Copy link

Since this issue will be resolved only in a few months at the ealiest, for the time being, i use a workaround now. It's a whole different kind of pain but maybe it helps someone:

Since the latest update brought mouse support to the terminal, i changed my zsh config to allow mouse inputs, which in effect renders the whole windows terminal mouse handling void.
To do so download the script by Stephane Chazelas and run it:

wget http://stchaz.free.fr/mouse.zsh
. ./mouse.zsh
zle-toggle-mouse

The issue here is that once a selection is started with shift+drag the starting point can't be changed without pressing any key on the keyboard to start a new selection. Also of course right click to copy won't work anymore.

As i said it's not great at all, but the frequency that i'm annoyed about those new issues during a day is less often.

@vadimkantorov
Copy link
Author

vadimkantorov commented Mar 20, 2020

Also one point from the OP we didn't discuss further: copying should not preferably make the selection area disappear, since after the copy one often wants to double-check what was copied or copy it again if the clipboard was rewritten for some reason (and with terminal we often copy between windows/applications, so this situation is quite often compared to a single vim session)

DHowett-MSFT pushed a commit that referenced this issue Mar 24, 2020
This commit rewrites selection handling at the TermControl layer.
Previously, we were keeping track of a number of redundant variables
that were easy to get out of sync.

The new selection model is as follows:

* A single left click will always begin a _pending_ selection operation
* A single left click will always clear a selection (#4477)
* A double left click will always begin a word selection
* A triple left click will always begin a line selection
* A selection will only truly start when the cursor moves a quarter of
  the smallest dimension of a cell (usually its width) in any direction
  _This eliminates the selection of a single cell on one click._
  (#4282, #5082)
* We now keep track of whether the selection has been "copied", or
  "updated" since it was last copied. If an endpoint moves, it is
  updated. For copy-on-select, it is only copied if it's updated.
  (#4740)

Because of this, we can stop tracking the position of the focus-raising
click, and whether it was part of click-drag operation. All clicks can
_become_ part of a click-drag operation if the user drags.

We can also eliminate the special handling of single cell selection at
the TerminalCore layer: since TermControl determines when to begin a
selection, TerminalCore no longer needs to know whether copy on select
is enabled _or_ whether the user has started and then backtracked over a
single cell. This is now implicit in TermControl.

Fixes #4082; Fixes #4477
@ghost ghost added the In-PR This issue has a related PR label Mar 24, 2020
@DHowett-MSFT
Copy link
Contributor

In PR today: removing the behavior where a lone single click without a drag selects a cell, making it so that a single click clears any active selection, and adding a distance threshold (0.25x one cell) to begin selecting

@DHowett-MSFT
Copy link
Contributor

I'm marking that PR as closing this bug, because it seems to fit the brief. Vadim, what do you think?

@vadimkantorov
Copy link
Author

In PR today: removing the behavior where a lone single click without a drag selects a cell, making it so that a single click clears any active selection, and adding a distance threshold (0.25x one cell) to begin selecting

I'm marking that PR as closing this bug, because it seems to fit the brief. Vadim, what do you think?

Excellent news! @DHowett-MSFT please go ahead :)

@ghost ghost closed this as completed in #5096 Mar 25, 2020
ghost pushed a commit that referenced this issue Mar 25, 2020
This commit rewrites selection handling at the TermControl layer.
Previously, we were keeping track of a number of redundant variables
that were easy to get out of sync.

The new selection model is as follows:

* A single left click will always begin a _pending_ selection operation
* A single left click will always clear a selection (#4477)
* A double left click will always begin a word selection
* A triple left click will always begin a line selection
* A selection will only truly start when the cursor moves a quarter of
  the smallest dimension of a cell (usually its width) in any direction
  _This eliminates the selection of a single cell on one click._
  (#4282, #5082)
* We now keep track of whether the selection has been "copied", or
  "updated" since it was last copied. If an endpoint moves, it is
  updated. For copy-on-select, it is only copied if it's updated.
  (#4740)

Because of this, we can stop tracking the position of the focus-raising
click, and whether it was part of click-drag operation. All clicks can
_become_ part of a click-drag operation if the user drags.

We can also eliminate the special handling of single cell selection at
the TerminalCore layer: since TermControl determines when to begin a
selection, TerminalCore no longer needs to know whether copy on select
is enabled _or_ whether the user has started and then backtracked over a
single cell. This is now implicit in TermControl.

Fixes #5082; Fixes #4477
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Mar 25, 2020
@ghost
Copy link

ghost commented Apr 22, 2020

🎉This issue was addressed in #5096, which has now been successfully released as Windows Terminal Preview v0.11.1121.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants