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

[Integrated Terminal] Allow ctrl+backspace to delete entire word in cmd.exe #98404

Closed
connorskees opened this issue May 22, 2020 · 9 comments · Fixed by #98494
Closed

[Integrated Terminal] Allow ctrl+backspace to delete entire word in cmd.exe #98404

connorskees opened this issue May 22, 2020 · 9 comments · Fixed by #98494
Assignees
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code terminal Integrated terminal issues windows VS Code on Windows issues
Milestone

Comments

@connorskees
Copy link
Contributor

Within the integrated terminal using cmd.exe, I'd like to be able to use ctrl+backspace in order to delete an entire word, as can be done in the regular editor. ctrl+backspace does work inside powershell, but not when using cmd.exe.

This is currently possible within the new Windows Terminal as well as the "old" Windows 10 terminal,
microsoft/terminal#755

@Tyriar Tyriar added feature-request Request for new features or functionality terminal Integrated terminal issues windows VS Code on Windows issues labels May 26, 2020
@Tyriar Tyriar added this to the June 2020 milestone May 26, 2020
@Tyriar Tyriar modified the milestones: June 2020, July 2020 Jun 29, 2020
@Tyriar Tyriar added the verification-needed Verification of issue is requested label Aug 3, 2020
@RMacfarlane RMacfarlane added the verified Verification succeeded label Aug 5, 2020
@RMacfarlane
Copy link
Contributor

@Tyriar I'm still seeing ctrl+backspace deleting single characters in cmd.exe in the latest insiders. When usering powershell, I see ^W inserted after text on ctrl+backspace. The only terminal related setting I have set is "terminal.integrated.shell.windows" and I don't have any other keybindings set for ctrl+backspace

@RMacfarlane RMacfarlane reopened this Aug 5, 2020
@RMacfarlane RMacfarlane added verification-found Issue verification failed and removed verified Verification succeeded labels Aug 5, 2020
@connorskees
Copy link
Contributor Author

@RMacfarlane I am unable to reproduce the deletion of single characters in cmd.exe or ^W in powershell. The behavior for powershell in particular seems strange -- I believe powershell accepts both ctrl+h and ctrl+w for deletion of an entire word.

Your description of the behavior appears to be the same as that prior to #98494; however, cmd.exe and powershell seem flipped. I would think that it would be cmd.exe emitting ^W and powershell simply deleting a single character.

Since #98494 was merged, I have been seeing the correct behavior in code-insiders. It is strange that your version seems to be without the change.

1.48.0-insider
5696babbc1dce41788bae04b1a04ad35140bebfb
x64

Is ^W still inserted for you after unfocusing and refocusing the terminal? Within the original pull request,

I was unable to get around an issue in which the keybinding would not register for cmd.exe until the user unfocuses the terminal, either by clicking out of it, closing it (ctrl+backtick), or minimizing vscode. It only occurs when there are two bindings to the key -- when removing the other (^W) binding this issue no longer occurs.

In practice I do occasionally run into this. This should only ever affect cmd.exe -- I have never had it occur for either wsl2 or powershell. I am not sure if there is a good solution for this. The difficulty here is supporting both cmd.exe and WSL. It seems even microsoft/terminal does not correctly delete a whole word for WSL, though it does for cmd.exe and powershell.

I suppose the issue here is more related to how keybindings are handled in that when there is a collision of bindings and one version is conditionally based on the currently focused shell, it requires one to unfocus the terminal for it to take effect.

@Tyriar Tyriar removed the verification-found Issue verification failed label Aug 5, 2020
@Tyriar Tyriar modified the milestones: July 2020, August 2020 Aug 5, 2020
@Tyriar Tyriar modified the milestones: August 2020, Backlog Aug 28, 2020
@rzhao271 rzhao271 removed the verification-needed Verification of issue is requested label Oct 27, 2020
@gvanrossum
Copy link

I get this too. I see it both in powershell and in the python REPL running in powershell.

@Tyriar
Copy link
Member

Tyriar commented Jan 25, 2021

@gvanrossum you might be on an older version of powershell? pwsh 7 works for me. For python, created #114919

@nt4f04uNd
Copy link

In Windows Terminal this works regardless of the backend, i.e. it works in python, CMD, whatever

@Tyriar
Copy link
Member

Tyriar commented Jun 7, 2021

@nt4f04uNd I believe Windows Terminal sends actual keystrokes via the Windows native console API for these which would be handled correctly, whereas we want to avoid treating the communication with the underlying process on Windows specially.

@lf-novelt
Copy link

lf-novelt commented Nov 8, 2023

ctrl+backspace does not work for me in either VS Code or VS Code insider integrated terminal "cmd.exe"
I'd tried to override the default keybinding by

    {
        "key": "ctrl+backspace",
        "command": "workbench.action.terminal.sendSequence",
        "when": "terminalFocus && terminalShellType == 'cmd'",
        "args": {
            "text": "\u0017"
        }
    }

but it produces ^W output instead of deleting the word.
image

By default, it simply deletes 1 character.

Please help, it's unbearable to not being able to delete a whole word, should be a built-in behavior of any terminal tool, not sure why it has been marked "out of scope"

@Tyriar
Copy link
Member

Tyriar commented Nov 8, 2023

@lf-novelt there is a default keybinding for cmd and it works fine for me:

image
Recording 2023-11-08 at 11 39 34

You may need to update Windows if it's not working for you?

@lf-novelt
Copy link

lf-novelt commented Nov 9, 2023

just updated Windows (Version 10.0.19045.3636), no more update to do -> same issue (it works well in regular cmd.exe, but not in VSCode)

however I see this suspicious output in the keybinding troubleshooting log -> Ignoring single modifier ctrl due to it being pressed together with other keys.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code terminal Integrated terminal issues windows VS Code on Windows issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants
@Tyriar @gvanrossum @RMacfarlane @rzhao271 @nt4f04uNd @connorskees @lf-novelt and others