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

Selection with the shift key does not actually select #13369

Closed
ofek opened this issue Jun 23, 2022 · 17 comments
Closed

Selection with the shift key does not actually select #13369

ofek opened this issue Jun 23, 2022 · 17 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Milestone

Comments

@ofek
Copy link
Contributor

ofek commented Jun 23, 2022

Windows Terminal version

1.14.1451.0

Windows build number

10.0.19044.0

Other Software

No response

Steps to reproduce

Go to a previous command, press home to go to the start of it, then shift+end to select it, then finally ctrl+c.

Config:

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{1cdf69ac-06b5-4a6f-9fb2-bf594c683073}",
    "initialCols": 200,
    "initialPosition": "0,0",
    "initialRows": 40,
    "actions":
    [
        { "command": "markMode", "keys": "ctrl+shift+m" },
        { "command": { "action": "adjustOpacity", "opacity": -10 }, "keys": "ctrl+shift+-" },
        { "command": { "action": "adjustOpacity", "opacity": 10 }, "keys": "ctrl+shift+=" },
        { "command": "globalSummon", "keys": "browser_stop" },
        { "command": "toggleFocusMode", "keys": "ctrl+numpad_plus" },
        { "command": "find", "keys": "ctrl+f" },
        { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },
        { "command": "selectAll", "keys": "ctrl+a" },
        { "command": "scrollDownPage", "keys": "pgdn" },
        { "command": "scrollUpPage", "keys": "pgup" },
        { "command": "newTab", "keys": "ctrl+t" },
        { "command": { "action": "newTab", "elevate": true, "profile": "PowerShell" }, "keys": "ctrl+shift+t" },
        { "command": "closeTab", "keys": "f13" },
        { "command": "closeOtherTabs", "keys": "shift+f13" },
        { "command": "nextTab", "keys": "f14" },
        { "command": "prevTab", "keys": "f15" },
        { "command": { "action" : "moveTab", "direction": "forward" }, "keys": "shift+f14" },
        { "command": { "action" : "moveTab", "direction": "backward" }, "keys": "shift+f15" },
        { "command": "closePane", "keys": "shift+escape" },
        { "command": "togglePaneZoom", "keys": "ctrl+numpad_multiply" },
        { "command": "toggleReadOnlyMode", "keys": "ctrl+shift+numpad_multiply" },
        { "command": { "action": "splitPane", "split": "up" }, "keys": "ctrl+up" },
        { "command": { "action": "splitPane", "split": "down" }, "keys": "ctrl+down" },
        { "command": { "action": "splitPane", "split": "left" }, "keys": "ctrl+left" },
        { "command": { "action": "splitPane", "split": "right" }, "keys": "ctrl+right" },
        { "command": { "action": "resizePane", "direction": "up" }, "keys": "ctrl+shift+up" },
        { "command": { "action": "resizePane", "direction": "down" }, "keys": "ctrl+shift+down" },
        { "command": { "action": "resizePane", "direction": "left" }, "keys": "ctrl+shift+left" },
        { "command": { "action": "resizePane", "direction": "right" }, "keys": "ctrl+shift+right" },
        { "command": { "action": "moveFocus", "direction": "previousInOrder" }, "keys": "browser_back" },
        { "command": { "action": "moveFocus", "direction": "nextInOrder" }, "keys": "browser_forward" },
        { "command": { "action": "swapPane", "direction": "previousInOrder"}, "keys": "shift+browser_back" },
        { "command": { "action": "swapPane", "direction": "nextInOrder"}, "keys": "shift+browser_forward" }
    ],
    "profiles":
    {
        "defaults": {
            "colorScheme": "Andromeda",
            "selectionBackground": "#FFFFFF",
            "opacity": 70,
            "useAcrylic": true,
            "startingDirectory": "C:\\Users\\ofek\\Desktop",
            "padding": "4, 4, 4, 4",
            "font": {
                "face": "CaskaydiaCove Nerd Font",
                "size": 12,
                "features": {
                    "ss01": 1,
                    "liga": 1
                }
            },
            "bellStyle": "all",
            "experimental.useAtlasEngine": false,
            "experimental.connection.passthroughMode": false
        },
        "list":
        [
            {
                "guid": "{1cdf69ac-06b5-4a6f-9fb2-bf594c683073}",
                "hidden": false,
                "name": "xonsh",
                "commandline": "C:\\Users\\ofek\\AppData\\Local\\Programs\\Python\\Python311\\python.exe -m xonsh",
                "icon": "C:\\Users\\ofek\\AppData\\Local\\Packages\\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\\RoamingState\\xonsh.png"
            },
            {
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt"
            },
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{67128ff7-83ea-54b4-bce0-f65dabb01753}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{00ead8f1-1057-5228-99b3-ce3a45a50ba6}",
                "hidden": false,
                "name": "Developer PowerShell for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{9fcb6b3a-b1e0-59d5-926b-0bddfb49d36d}",
                "hidden": true,
                "name": "Developer Command Prompt for VS 2017",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{a3a2e83a-884a-5379-baa8-16f193a13b21}",
                "hidden": false,
                "name": "PowerShell 7 Preview",
                "source": "Windows.Terminal.PowershellCore"
            }
        ]
    },
    "theme": "dark",
    "schemes":
    [
          {
            "name": "Andromeda",
            "black": "#000000",
            "red": "#cd3131",
            "green": "#05bc79",
            "yellow": "#e5e512",
            "blue": "#2472c8",
            "purple": "#bc3fbc",
            "cyan": "#0fa8cd",
            "white": "#e5e5e5",
            "brightBlack": "#666666",
            "brightRed": "#cd3131",
            "brightGreen": "#05bc79",
            "brightYellow": "#e5e512",
            "brightBlue": "#2472c8",
            "brightPurple": "#bc3fbc",
            "brightCyan": "#0fa8cd",
            "brightWhite": "#e5e5e5",
            "background": "#262a33",
            "foreground": "#e5e5e5",
            "selectionBackground": "#5a5c62",
            "cursorColor": "#f8f8f0"
          }
    ]
}

Expected Behavior

Highlighted command is copied

Actual Behavior

It interrupts rather than copies

@ofek ofek added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jun 23, 2022
@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 Jun 23, 2022
@carlos-zamora carlos-zamora self-assigned this Jun 23, 2022
@naikrovek
Copy link

are you still holding SHIFT when you press CTRL+C?

@ofek
Copy link
Contributor Author

ofek commented Jun 24, 2022

No

@ofek
Copy link
Contributor Author

ofek commented Jun 27, 2022

can you reproduce?

@carlos-zamora carlos-zamora added this to the Terminal v1.15 milestone Jul 2, 2022
@carlos-zamora
Copy link
Member

I've been looking at this a little bit over the course of the week and I haven't been able to get a repro. I'm throwing this into the 1.15 milestone though because I would like for this to get resolved before we release.

That said, I have a question regarding your repro steps:

Go to a previous command, press home to go to the start of it, then shift+end to select it, then finally ctrl+c.

How do you go to the previous command exactly? Like, in mark mode? You just scroll there and click+drag on it to make a selection? A few more details here would help.

Thanks! Sorry it's taken a bit longer than expected to get around to this one 😅

@carlos-zamora carlos-zamora added the Product-Terminal The new Windows Terminal. label Jul 2, 2022
@ofek
Copy link
Contributor Author

ofek commented Jul 2, 2022

No as in like press up (history)

b

@ofek
Copy link
Contributor Author

ofek commented Jul 2, 2022

xonsh shell btw if that matters

@zadjii-msft
Copy link
Member

zadjii-msft commented Jul 5, 2022

Wait I might see the issue here:

  1. Go to a previous command,
  2. press home to go to the start of it,
  3. then shift+end to select it,
  4. then finally ctrl+c.

Do you actually enter mark mode between 2 & 3? Or are you literally just hitting shift+end?

OH okay I see what's happening here. xonsh is managing its own selection here. I bet there's some prompt_toolkit magic at work here.

related: xonsh/xonsh#3697

@ofek
Copy link
Contributor Author

ofek commented Jul 5, 2022

Interesting! This works in ConEmu though, do you know how?

@zadjii-msft
Copy link
Member

It would seem that ConEmu has shift+end (as well as home and the arrows) bound to creating a terminal-side selection by default. So essentially, by hitting those keys, you're entering an "implicit" mark mode[1], and not even allowing xonsh the opportunity to receive those keystrokes.

I don't think we've currently got a good solution for "enter mark mode (if not already in it), and move the selection marker" in the 1.15 preview.

[1]: I'm definitely bastardizing our concept of mark mode on to conemu here, for simplicity.

@zadjii-msft
Copy link
Member

For future notes:
image

(from conemu settings)

@ofek
Copy link
Contributor Author

ofek commented Jul 5, 2022

Ah okay, so in 1.15 I would press the mark mode keybinding, then shift+end, then ctrl+c/Enter to copy and exit mark mode? If so, that's not too bad.

@zadjii-msft
Copy link
Member

Ah okay, so in 1.15 I would press the mark mode keybinding, then shift+end, then ctrl+c/Enter to copy and exit mark mode? If so, that's not too bad.

That's correct!

<bookkeeping>

I'm gonna take this out of 1.15, and mark up for discussion on the shift+arrows selection. As implemented in 1.15, this is working as expected, but maybe it-could-be-better.png.

@zadjii-msft zadjii-msft modified the milestones: Terminal v1.15, Backlog Jul 5, 2022
@zadjii-msft zadjii-msft added Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Discussion Something that requires a team discussion before we can proceed Area-Settings Issues related to settings and customizability, for console or terminal and removed Issue-Bug It either shouldn't be doing this or needs an investigation. labels Jul 5, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jul 5, 2022
@ofek

This comment was marked as off-topic.

@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 5, 2022
@zadjii-msft

This comment was marked as off-topic.

@carlos-zamora
Copy link
Member

Ok. Chatted about it at sync today. Here were some notes:

  • This is pretty similar to [Command Prompt] : User is not able to Select commands using 'Shift+ right/Left arrow keys' inside Command Prompt. #11985 in that a terminal-side selection is created implicitly. There, Shift+Left can immediately enter mark mode and create a selection to the left.
  • Here, we're talking about Shift+End entering mark mode and creating a selection to the "end". The tricky part is that "end" is first defined as the end of the input buffer, then defined as the end of the line.
  • We could be smarted about cooked read and the input buffer to be able to allow functionality for that first part ("end" --> end of the input buffer). In fact, we should do that, but that's feature work we're gonna have to throw onto the backlog.
  • There's also a concern about creating confusion between shell-side selections and terminal-side selections. PowerShell, for example, lets you do a shell-side selection, which provides a rich experience where you can also cut text. ConEmu intelligently knows when to do that while also only doing terminal-side selections. If we don't have that intelligent functionality, it's easy for the user to be confused as to why some selections allow you to "cut" the text while others don't.
  • Proposed solution:
    • the "quick-n-easy" fix here would be that we introduce a global setting or some button in the settings UI like "experimental.implicitMarkModeActions" that would generate a number of actions that allow you to implicitly create a terminal-side selection with keybindings like Shift+Left or Shift+End.
    • These actions would probably be a bit ugly, but they would be a sequence of actions like "enter mark mode" --> "expand selection to the left (or end of line)"
    • This would create a terminal-side selection that allows you to select and copy text as allowed in mark mode, but not provide a rich experience like cutting text (which I personally think is fine, I'd bet 99% of the time you just want to copy).

@zadjii-msft
Copy link
Member

For bookkeeping purposes, we're gonna merge this in with /dup #11985. Thanks for all the great discussion here!

@ghost
Copy link

ghost commented Aug 2, 2022

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Aug 2, 2022
@ghost ghost added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Aug 2, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

4 participants