Backspacing offscreen should not be possible #191

Closed
opened 2026-01-30 21:45:10 +00:00 by claunia · 5 comments
Owner

Originally created by @j4james on GitHub (Mar 14, 2018).

Originally assigned to: @zadjii-msft on GitHub.

  • Your Windows build number:

Microsoft Windows [Version 10.0.16299.248]

  • What you're doing and what's happening:

If I output a sequence of backspace characters when the cursor position is in the leftmost column of the screen, I would expect that to have no effect, since the cursor can't move any further leftward. And this is the behaviour that I see in DOS, the old Windows console, and the Linux console. On the new Windows 10 console, though, a backspace in the leftmost column causes the cursor position to wrap around to the end of the previous line.

For example, enter the following command in a bash console:

printf "\b\b\b\bTEST\n"

On Linux that outputs "TEST" at the start of the line, while in the Windows 10 console it outputs "TEST" at the end of the previous line.

What is really odd, though, is if the cursor is positioned in the top left corner of the screen, a backspace command can actually end up moving the cursor entirely offscreen.

For this to occur, you need to have something in the scrollback buffer, so you'll first have to do a directory listing or something that fills up the screen. Then enter the following command:

printf "\033[H\033[J\b\b\b\bTEST\n"

Note that the "TEST" is not visible onscreen, but if you scroll up, you'll see that it has been output at the end of the line above the top of the screen.

  • What's wrong / what should be happening instead:

I don't think a backspace should have any effect when the cursor is in the leftmost column of the screen. But even if that backspace wrapping is intentional, I definitely wouldn't expect it to apply when the cursor is in the top left corner of the screen.

Originally created by @j4james on GitHub (Mar 14, 2018). Originally assigned to: @zadjii-msft on GitHub. * Your Windows build number: Microsoft Windows [Version 10.0.16299.248] * What you're doing and what's happening: If I output a sequence of backspace characters when the cursor position is in the leftmost column of the screen, I would expect that to have no effect, since the cursor can't move any further leftward. And this is the behaviour that I see in DOS, the old Windows console, and the Linux console. On the new Windows 10 console, though, a backspace in the leftmost column causes the cursor position to wrap around to the end of the previous line. For example, enter the following command in a bash console: printf "\b\b\b\bTEST\n" On Linux that outputs "TEST" at the start of the line, while in the Windows 10 console it outputs "TEST" at the end of the previous line. What is really odd, though, is if the cursor is positioned in the top left corner of the screen, a backspace command can actually end up moving the cursor entirely offscreen. For this to occur, you need to have something in the scrollback buffer, so you'll first have to do a directory listing or something that fills up the screen. Then enter the following command: printf "\033[H\033[J\b\b\b\bTEST\n" Note that the "TEST" is not visible onscreen, but if you scroll up, you'll see that it has been output at the end of the line above the top of the screen. * What's wrong / what should be happening instead: I don't think a backspace should have any effect when the cursor is in the leftmost column of the screen. But even if that backspace wrapping is intentional, I definitely wouldn't expect it to apply when the cursor is in the top left corner of the screen.
claunia added the Product-Conhost label 2026-01-30 21:45:10 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Mar 15, 2018):

I'll need to double check this is a regression from v1, but assuming it is, this definitely counts as a bug. Even if it's not, that's not what I'd expect to happen - we can certainly try and fix this.

@zadjii-msft commented on GitHub (Mar 15, 2018): I'll need to double check this is a regression from v1, but assuming it is, this definitely counts as a bug. Even if it's not, that's not what I'd expect to happen - we can certainly try and fix this.
Author
Owner

@j4james commented on GitHub (Mar 16, 2018):

Just to be clear, when I said the old Windows console I meant the console on older versions of Windows (I was testing Windows Vista to be more specific) and not the pre-AU console on Windows 10. Not sure if that aligns with your idea of v1.

Btw thank you for the fantastic work you've been doing on the console - the new functionality is much appreciated.

@j4james commented on GitHub (Mar 16, 2018): Just to be clear, when I said the old Windows console I meant the console on older versions of Windows (I was testing Windows Vista to be more specific) and not the pre-AU console on Windows 10. Not sure if that aligns with your idea of v1. Btw thank you for the fantastic work you've been doing on the console - the new functionality is much appreciated.
Author
Owner

@zadjii-msft commented on GitHub (Mar 16, 2018):

@j4james Yea, that's what I mean when I say v1. "Conhostv1" is a version of the console code that was parked when the console was first getting some love at the beginning of Windows 10. So, when you check the "Use legacy Console" checkbox, that's the same experience as everything before windows 10.

@zadjii-msft commented on GitHub (Mar 16, 2018): @j4james Yea, that's what I mean when I say v1. "Conhostv1" is a version of the console code that was parked when the console was first getting some love at the beginning of Windows 10. So, when you check the "Use legacy Console" checkbox, that's the same experience as everything before windows 10.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 21, 2018):

It looks like this fix shipped in the 1809 update. Thanks for reporting!

@DHowett-MSFT commented on GitHub (Nov 21, 2018): It looks like this fix shipped in the 1809 update. Thanks for reporting!
Author
Owner

@egmontkob commented on GitHub (Nov 13, 2019):

For future reference:

I don't think a backspace should have any effect when the cursor is in the leftmost column of the screen.

In xterm, this is controlled by the "Reverse-wraparound Mode": printf "\e[?45h" / printf "\e[?45l"

screen and urxvt perform reverse-wraparound, whereas tmux wraps backwards only across implicit overflows and not across explicit newlines. I don't know how many terminals support toggling the mode.

The desired behavior is potentially part of a much broader picture: to make sure entering a multi-line string in cooked tty mode is an okay user experience, even if one has to correct a typo just at the margin. See https://gitlab.gnome.org/GNOME/vte/issues/62.

But even if that backspace wrapping is intentional, I definitely wouldn't expect it to apply when the cursor is in the top left corner of the screen.

I agree, the cursor shouldn't be able to walk back to the scrollback buffer.

@egmontkob commented on GitHub (Nov 13, 2019): For future reference: > I don't think a backspace should have any effect when the cursor is in the leftmost column of the screen. In xterm, this is controlled by the "Reverse-wraparound Mode": `printf "\e[?45h"` / `printf "\e[?45l"` `screen` and `urxvt` perform reverse-wraparound, whereas `tmux` wraps backwards only across implicit overflows and not across explicit newlines. I don't know how many terminals support toggling the mode. The desired behavior is potentially part of a much broader picture: to make sure entering a multi-line string in cooked tty mode is an okay user experience, even if one has to correct a typo just at the margin. See https://gitlab.gnome.org/GNOME/vte/issues/62. > But even if that backspace wrapping is intentional, I definitely wouldn't expect it to apply when the cursor is in the top left corner of the screen. I agree, the cursor shouldn't be able to walk back to the scrollback buffer.
Sign in to join this conversation.
No Label Product-Conhost
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#191