Backspace deletes whole word instead of character #18824

Open
opened 2026-01-31 06:25:30 +00:00 by claunia · 18 comments
Owner

Originally created by @umnyaga on GitHub (Nov 4, 2022).

Originally assigned to: @PankajBhojwani on GitHub.

Windows Terminal version

1.15.2874.0, 1.16.2641.0

Windows build number

10.0.19043.0

Other Software

No response

Steps to reproduce

type several word in shell command line and press backspace.

Expected Behavior

Backspace deletes character left unstead od whole words

Actual Behavior

In Power Shell or Cmd running in Windows Terminal, pressing backspace deletes whole word left instead of character left. It's interesting, once ssh to remote linux host from that powershell window, backspace behavior becomes normal. I found it on my home PC and on at workplace's PC.

Originally created by @umnyaga on GitHub (Nov 4, 2022). Originally assigned to: @PankajBhojwani on GitHub. ### Windows Terminal version 1.15.2874.0, 1.16.2641.0 ### Windows build number 10.0.19043.0 ### Other Software _No response_ ### Steps to reproduce type several word in shell command line and press backspace. ### Expected Behavior Backspace deletes character left unstead od whole words ### Actual Behavior In Power Shell or Cmd running in Windows Terminal, pressing backspace deletes whole word left instead of character left. It's interesting, once ssh to remote linux host from that powershell window, backspace behavior becomes normal. I found it on my home PC and on at workplace's PC.
claunia added the Issue-BugArea-InputNeeds-ReproProduct-Terminal labels 2026-01-31 06:25:30 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Nov 4, 2022):

What keyboard layout are you using? I'm betting there's an encoding glitch where we're treating the Bksp as Ctrl+Bksp for some reason.

@zadjii-msft commented on GitHub (Nov 4, 2022): What keyboard layout are you using? I'm betting there's an encoding glitch where we're treating the Bksp as Ctrl+Bksp for some reason.
Author
Owner

@umnyaga commented on GitHub (Nov 4, 2022):

I use HP C3758A and another Lenovo standard, do not know the model number, but it is simple one without any fanciness. Both standard US layout. These two keyboards belong to most standard ones as it gets.

@umnyaga commented on GitHub (Nov 4, 2022): I use HP C3758A and another Lenovo standard, do not know the model number, but it is simple one without any fanciness. Both standard US layout. These two keyboards belong to most standard ones as it gets.
Author
Owner

@zadjii-msft commented on GitHub (Nov 4, 2022):

Hmm #13894

@zadjii-msft commented on GitHub (Nov 4, 2022): Hmm #13894
Author
Owner

@umnyaga commented on GitHub (Nov 5, 2022):

Hmm, interesting. I've never tried, but Ctrl-Backspace deletes character left.

@umnyaga commented on GitHub (Nov 5, 2022): Hmm, interesting. I've never tried, but Ctrl-Backspace deletes character left.
Author
Owner

@carlos-zamora commented on GitHub (Nov 7, 2022):

Our leading theory is that this is being caused by referencing uninitialized memory. That should be fixed via https://github.com/microsoft/terminal/pull/14345. So we'll hope that fixes this, and circle back around after it's merged.

@carlos-zamora commented on GitHub (Nov 7, 2022): Our leading theory is that this is being caused by referencing uninitialized memory. That should be fixed via https://github.com/microsoft/terminal/pull/14345. So we'll hope that fixes this, and circle back around after it's merged.
Author
Owner

@zadjii-msft commented on GitHub (Dec 15, 2022):

@umnyaga can you try out v1.15.3465.0 / v1.15.3466. (or the latest 1.16 build), and see if that fixes this/?

@zadjii-msft commented on GitHub (Dec 15, 2022): @umnyaga can you try out [v1.15.3465.0 / v1.15.3466](https://github.com/microsoft/terminal/releases/tag/v1.15.3465.0). (or the latest 1.16 build), and see if that fixes this/?
Author
Owner

@umnyaga commented on GitHub (Dec 15, 2022):

@umnyaga can you try out v1.15.3465.0 / v1.15.3466. (or the latest 1.16 build), and see if that fixes this/?

@zadjii-msft just tried, there is no changes in behavior, backspace still deletes a word left.

@umnyaga commented on GitHub (Dec 15, 2022): > @umnyaga can you try out [v1.15.3465.0 / v1.15.3466](https://github.com/microsoft/terminal/releases/tag/v1.15.3465.0). (or the latest 1.16 build), and see if that fixes this/? @zadjii-msft just tried, there is no changes in behavior, backspace still deletes a word left.
Author
Owner

@zadjii-msft commented on GitHub (Dec 15, 2022):

Huh. The assumption here is that DECBKM is defaulting to on for you, but there's pretty much no reason that should be. There would need to be some sort of \x1b[?67h in your profile.ps1 or something, but then I wouldn't expect this to repro in CMD as well.

I wonder if we could test that... I don't think pwsh uses VT for input events at all, so that's not

Wait a second, neither CMD nor pwsh would be using VT input. So this shouldn't be that at all. It's like there's something else swapping Bkspc and DEL

@zadjii-msft commented on GitHub (Dec 15, 2022): Huh. The assumption here is that `DECBKM` is defaulting to _on_ for you, but there's pretty much no reason that should be. There would need to be some sort of `\x1b[?67h` in your `profile.ps1` or something, but then I wouldn't expect this to repro in CMD as well. I wonder if we could test that... I don't think pwsh uses VT for input events at all, so that's not Wait a second, neither CMD nor pwsh would be using VT input. So this _shouldn't_ be that at all. It's like there's something else swapping Bkspc and DEL
Author
Owner

@zadjii-msft commented on GitHub (Dec 15, 2022):

Can you try repro'ing this with the debug tap to get a trace of all the input and output? Once the bug starts occurring, send us a screenshot and we might be able to figure out what the Terminal thinks it's getting here.

@zadjii-msft commented on GitHub (Dec 15, 2022): Can you try repro'ing this with the [debug tap](https://github.com/microsoft/terminal/wiki/Enabling-the-debug-tap) to get a trace of all the input and output? Once the bug starts occurring, send us a screenshot and we might be able to figure out what the Terminal thinks it's getting here.
Author
Owner

@j4james commented on GitHub (Dec 15, 2022):

@zadjii-msft FYI, you can kind of trick the terminal into enabling DECBKM by exploiting the way we pass through modes that aren't recognised. However, that requires the Win32 input mode is disabled as well. For example, in PowerShell you'd need to do something like this:

echo "`e[?9001;9999l"
echo "`e[?67;9999h"

I wouldn't have thought it likely that anyone is doing that accidentally, though. But if DECBKM is to blame, you ought to be able to "fix" it with something like this:

echo "`e[?67;9999l"
@j4james commented on GitHub (Dec 15, 2022): @zadjii-msft FYI, you can kind of trick the terminal into enabling `DECBKM` by exploiting the way we pass through modes that aren't recognised. However, that requires the Win32 input mode is disabled as well. For example, in PowerShell you'd need to do something like this: ``` echo "`e[?9001;9999l" echo "`e[?67;9999h" ``` I wouldn't have thought it likely that anyone is doing that accidentally, though. But if `DECBKM` is to blame, you ought to be able to "fix" it with something like this: ``` echo "`e[?67;9999l" ```
Author
Owner

@umnyaga commented on GitHub (Dec 15, 2022):

Can you try repro'ing this with the debug tap to get a trace of all the input and output? Once the bug starts occurring, send us a screenshot and we might be able to figure out what the Terminal thinks it's getting here.

Here is what I've got
image

@umnyaga commented on GitHub (Dec 15, 2022): > Can you try repro'ing this with the [debug tap](https://github.com/microsoft/terminal/wiki/Enabling-the-debug-tap) to get a trace of all the input and output? Once the bug starts occurring, send us a screenshot and we might be able to figure out what the Terminal thinks it's getting here. Here is what I've got ![image](https://user-images.githubusercontent.com/48327531/207925765-33e634ec-5950-4901-893f-d4039d3a9e8e.png)
Author
Owner

@j4james commented on GitHub (Dec 15, 2022):

That's really weird. It appears that the backspace key is somehow bypassing the Win32 input mode encoding. We should be seeing keydown and keyup events for a VK_BACK key, (i.e. ␛[8;14;8;1;32;1_ ␛[8;14;8;0;32;1_), but instead we're getting a single character. I have no idea how that could happen.

@j4james commented on GitHub (Dec 15, 2022): That's really weird. It appears that the backspace key is somehow bypassing the Win32 input mode encoding. We should be seeing keydown and keyup events for a `VK_BACK` key, (i.e. `␛[8;14;8;1;32;1_` `␛[8;14;8;0;32;1_`), but instead we're getting a single `␈` character. I have no idea how that could happen.
Author
Owner

@zadjii-msft commented on GitHub (Dec 15, 2022):

Wow, uh, me neither. Maybe it's coming through on the... character handler, instead of the key one? This is super bizarre. Turning off win32 input probably wouldn't fix this either, then, cause the event would still get sent as a BS char, which would still get translated wrong.

@zadjii-msft commented on GitHub (Dec 15, 2022): Wow, uh, me neither. Maybe it's coming through on the... character handler, instead of the key one? This is super bizarre. Turning off win32 input probably wouldn't fix this either, then, cause the event would still get sent as a BS char, which would still get translated wrong.
Author
Owner

@clau3107 commented on GitHub (Jan 24, 2023):

@zadjii-msft FYI, you can kind of trick the terminal into enabling DECBKM by exploiting the way we pass through modes that aren't recognised. However, that requires the Win32 input mode is disabled as well. For example, in PowerShell you'd need to do something like this:

echo "`e[?9001;9999l"
echo "`e[?67;9999h"

I wouldn't have thought it likely that anyone is doing that accidentally, though. But if DECBKM is to blame, you ought to be able to "fix" it with something like this:

echo "`e[?67;9999l"

This fixed it for me, thank you!

@clau3107 commented on GitHub (Jan 24, 2023): > @zadjii-msft FYI, you can kind of trick the terminal into enabling `DECBKM` by exploiting the way we pass through modes that aren't recognised. However, that requires the Win32 input mode is disabled as well. For example, in PowerShell you'd need to do something like this: > > ``` > echo "`e[?9001;9999l" > echo "`e[?67;9999h" > ``` > > I wouldn't have thought it likely that anyone is doing that accidentally, though. But if `DECBKM` is to blame, you ought to be able to "fix" it with something like this: > > ``` > echo "`e[?67;9999l" > ``` This fixed it for me, thank you!
Author
Owner

@andersforsgren commented on GitHub (Aug 8, 2024):

This is still an intermittent issue in cmd in the latest version (1.20.11781.0) and the ^[[?67;9999l fix does not help it.

@andersforsgren commented on GitHub (Aug 8, 2024): This is still an intermittent issue in cmd in the latest version (1.20.11781.0) and the `^[[?67;9999l` fix does not help it.
Author
Owner

@ovianao commented on GitHub (Oct 1, 2025):

I can 100% reproduce this on Windows 11, 23H2, in the command prompt, immediately after performing "git pull".

The command prompt when opened freshly, erases just one character with backspace, meanwhile holding ctrl and pressing backspace erases the whole word. Once I perform "git pull", the behaviour is reversed, namely pressing backspace on its own erases the whole word, and holding ctrl and pressing backspace erases a single character.

Doing this, does not help:
git config --global color.ui false

This is seen both on git 2.43.0, as well as 2.51.0 (latest).
cmd.exe is version 10.0.22621.5697.

Enabling the option "Use legacy console (requires relaunch, affects all consoles)" in the command prompt setting, fixes the above behaviour. Though I presume this should not be necessary.

Pressing Del, after git pull, results in this at the terminal: ^[[3~
"cls" does not resolve it, but running "clear" which is bundled with git linux tools restores functionality.

@ovianao commented on GitHub (Oct 1, 2025): I can 100% reproduce this on Windows 11, 23H2, in the command prompt, immediately after performing "git pull". The command prompt when opened freshly, erases just one character with backspace, meanwhile holding ctrl and pressing backspace erases the whole word. Once I perform "git pull", the behaviour is reversed, namely pressing backspace on its own erases the whole word, and holding ctrl and pressing backspace erases a single character. Doing this, does not help: git config --global color.ui false This is seen both on git 2.43.0, as well as 2.51.0 (latest). cmd.exe is version 10.0.22621.5697. Enabling the option "Use legacy console (requires relaunch, affects all consoles)" in the command prompt setting, fixes the above behaviour. Though I presume this should not be necessary. Pressing Del, after git pull, results in this at the terminal: ^[[3~ "cls" does not resolve it, but running "clear" which is bundled with git linux tools restores functionality.
Author
Owner

@umnyaga commented on GitHub (Oct 1, 2025):

I remedied the issue since I reported it. Unfortunately I forgot exactly what I did. The culprit was the configuration file (settings.json). I opened the file (Ctrl+Shift+,). And found that backspace has some assignment to it either in actions/command or in keybinding sections. Once I removed it, everything stated to work as it supposed to do. That config file came to me as part of the distribution or generated on demand by the program itself. Probably it is worth to looks there.

@umnyaga commented on GitHub (Oct 1, 2025): I remedied the issue since I reported it. Unfortunately I forgot exactly what I did. The culprit was the configuration file (settings.json). I opened the file (Ctrl+Shift+,). And found that backspace has some assignment to it either in actions/command or in keybinding sections. Once I removed it, everything stated to work as it supposed to do. That config file came to me as part of the distribution or generated on demand by the program itself. Probably it is worth to looks there.
Author
Owner

@MrLuje commented on GitHub (Nov 12, 2025):

I'm also seeing this behavior when switching between tabs.

  • Type a word in the first tab
  • hit CTRL+Tab to switch to the next tab
  • now go back to the previous tab and hit Backspace and it delete the whole word, as if the CTRL is not considered "released" from the previous CTRL+Tab
@MrLuje commented on GitHub (Nov 12, 2025): I'm also seeing this behavior when switching between tabs. - Type a word in the first tab - hit CTRL+Tab to switch to the next tab - now go back to the previous tab and hit Backspace and it delete the whole word, as if the CTRL is not considered "released" from the previous CTRL+Tab
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18824