Terminal prompt buggy redrawing #18094

Closed
opened 2026-01-31 06:03:32 +00:00 by claunia · 2 comments
Owner

Originally created by @vadimkantorov on GitHub (Aug 3, 2022).

Windows Terminal version

1.14.1963.0

Windows build number

10.0.22000.795

Other Software

No response

Steps to reproduce

In Terminal + WSLv1 Ubuntu:

  1. curl request that prints some well-formatted JSON. the output looks like:
somejson
}vadimkantorov@dell_de_vadim:/mnt/c/Users/vadim$
  1. Use arrow-up to retrieve this previous curl command from bash history. Then use Ctrl+Left to navigate to the beginning of the command
  2. The prompt will jump left, looks like (note two spaces and now missing curly brace):
vadimkantorov@dell_de_vadim:/mnt/c/Users/vadim$  curl 
  1. Start to modify the command, then the actual command to be run doesn't match the text on the screen, there are some sorts of off-by-one mistakes, the displayed text doesn't match what's in buffer

It makes very nasty to debug curl commands that return JSONs

Expected Behavior

The modified command matches the displayed text

Actual Behavior

the actual command to be run doesn't match the text on the screen,

Originally created by @vadimkantorov on GitHub (Aug 3, 2022). ### Windows Terminal version 1.14.1963.0 ### Windows build number 10.0.22000.795 ### Other Software _No response_ ### Steps to reproduce In Terminal + WSLv1 Ubuntu: 1. curl request that prints some well-formatted JSON. the output looks like: ``` somejson }vadimkantorov@dell_de_vadim:/mnt/c/Users/vadim$ ``` 2. Use arrow-up to retrieve this previous curl command from bash history. Then use Ctrl+Left to navigate to the beginning of the command 3. The prompt will jump left, looks like (note two spaces and now missing curly brace): ``` vadimkantorov@dell_de_vadim:/mnt/c/Users/vadim$ curl ``` 4. Start to modify the command, then the actual command to be run doesn't match the text on the screen, there are some sorts of off-by-one mistakes, the displayed text doesn't match what's in buffer It makes very nasty to debug curl commands that return JSONs ### Expected Behavior The modified command matches the displayed text ### Actual Behavior the actual command to be run doesn't match the text on the screen,
claunia added the Issue-BugNeeds-Tag-Fix labels 2026-01-31 06:03:32 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 3, 2022):

Gut guess - this is just a bash issue that happens whenever there's any output from the previous command on the line where bash is starting the next prompt. Does this repro with any other terminal emulator?

@zadjii-msft commented on GitHub (Aug 3, 2022): Gut guess - this is just a bash issue that happens whenever there's any output from the previous command on the line where bash is starting the next prompt. Does this repro with any other terminal emulator?
Author
Owner

@DHowett commented on GitHub (Aug 4, 2022):

This should repro with all terminal emulators. bash is very particular in that it will fail to render properly if it cannot guess where the prompt started.

If you switch to zsh, in its default configuration it has a mitigation for any command that exits without printing a final newline.

Since we don't control the shell, or the prompt, there's nothing we can do about this one :)

@DHowett commented on GitHub (Aug 4, 2022): This should repro with all terminal emulators. `bash` is very particular in that it will fail to render properly if it cannot guess where the prompt started. If you switch to zsh, in its default configuration it has a mitigation for any command that exits without printing a final newline. Since we don't control the shell, or the prompt, there's nothing we can do about this one :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18094