Backspacing offscreen should not be possible #189

Open
opened 2026-01-30 21:45:06 +00:00 by claunia · 0 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:06 +00:00
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#189