linewrap then backspace produces unexpected visuals, missing characters #1660

Closed
opened 2026-01-30 22:33:09 +00:00 by claunia · 12 comments
Owner

Originally created by @fredless on GitHub (Jun 13, 2019).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.175]
Windows Terminal version (if applicable): built using d82eab44d0

Steps to reproduce

  • open terminal with following profile:
{
    "globals" : 
    {
        "alwaysShowTabs" : false,
        "defaultProfile" : "{9d2406b9-7e40-4e2b-a20d-82dc61c4cc24}",
        "initialCols" : 80,
        "initialRows" : 60,
        "requestedTheme" : "dark",
        "showTabsInTitlebar" : true,
        "showTerminalTitleInTitlebar" : false
    },
    "profiles" : 
    [
        {
            "acrylicOpacity" : 0.80000001192092896,
            "closeOnExit" : true,
            "colorScheme" : "Solarized Dark",
            "commandline" : "cmd.exe",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "guid" : "{9d2406b9-7e40-4e2b-a20d-82dc61c4cc24}",
            "historySize" : 9001,
            "name" : "cmd",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "startingDirectory" : "%USERPROFILE%",
            "useAcrylic" : true
        }
    ]
}
  • input characters until the line wraps, backspace once, and enter an additional character

Expected behavior

  • Cursor should return to the previous position following the last character on the previous line after hitting backspace.
  • Additional input character (sent after backspace) should show up after the last character on the previous line.

Actual behavior

  • Cursor returns to previous line, but with a whitespace between the last character input and the cursor position
  • Additional input character does not show up in terminal, although it is recognized

'..789ab' is received as input in the example below, even though it is not shown:
GIF of issue

Originally created by @fredless on GitHub (Jun 13, 2019). Originally assigned to: @zadjii-msft on GitHub. # Environment Windows build number: Microsoft Windows [Version 10.0.18362.175] Windows Terminal version (if applicable): built using d82eab44d076e441f0b630d9b53a19dfa884c3ab # Steps to reproduce * open terminal with following profile: ```json { "globals" : { "alwaysShowTabs" : false, "defaultProfile" : "{9d2406b9-7e40-4e2b-a20d-82dc61c4cc24}", "initialCols" : 80, "initialRows" : 60, "requestedTheme" : "dark", "showTabsInTitlebar" : true, "showTerminalTitleInTitlebar" : false }, "profiles" : [ { "acrylicOpacity" : 0.80000001192092896, "closeOnExit" : true, "colorScheme" : "Solarized Dark", "commandline" : "cmd.exe", "cursorColor" : "#FFFFFF", "cursorShape" : "bar", "fontFace" : "Consolas", "fontSize" : 10, "guid" : "{9d2406b9-7e40-4e2b-a20d-82dc61c4cc24}", "historySize" : 9001, "name" : "cmd", "padding" : "0, 0, 0, 0", "snapOnInput" : true, "startingDirectory" : "%USERPROFILE%", "useAcrylic" : true } ] } ``` * input characters until the line wraps, backspace once, and enter an additional character # Expected behavior * Cursor should return to the previous position following the last character on the previous line after hitting backspace. * Additional input character (sent after backspace) should show up after the last character on the previous line. # Actual behavior * Cursor returns to previous line, but with a whitespace between the last character input and the cursor position * Additional input character does not show up in terminal, although it is recognized '..789ab' is received as input in the example below, even though it is not shown: ![GIF of issue](http://www.feasible.net/images/linewrapissue.gif)
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 13, 2019):

This is probably something down in the pseudoconsole layer; we probably have a duplicate for it, but we can't find it.

@DHowett-MSFT commented on GitHub (Jun 13, 2019): This is probably something down in the pseudoconsole layer; we probably have a duplicate for it, but we can't find it.
Author
Owner

@fredless commented on GitHub (Jun 14, 2019):

Should have also mentioned in case it may be helpful, identical behavior was observed on 73ad742c12

Didn't report then as that was my first exposure, assumed either I couldn't be the only one (or that I was). I just repulled and built in hopes it might have been squashed. I searched then and now before submitting but didn't see a specific match.

@fredless commented on GitHub (Jun 14, 2019): Should have also mentioned in case it may be helpful, identical behavior was observed on 73ad742c12c0d86a6edd4982ab7ee5590684d27e Didn't report then as that was my first exposure, assumed either I couldn't be the only one (or that I was). I just repulled and built in hopes it might have been squashed. I searched then and now before submitting but didn't see a specific match.
Author
Owner

@fredless commented on GitHub (Jun 25, 2019):

I can't be the only one.. can I?

@fredless commented on GitHub (Jun 25, 2019): I can't be the only one.. can I?
Author
Owner

@zadjii-msft commented on GitHub (Jul 2, 2019):

@fredless you're not the only one - this is a reasonable bug report with clear repro steps. Doesn't seem like there's much that needs to be added until someone starts working on a fix.

@zadjii-msft commented on GitHub (Jul 2, 2019): @fredless you're not the only one - this is a reasonable bug report with clear repro steps. Doesn't seem like there's much that needs to be added until someone starts working on a fix.
Author
Owner

@zadjii-msft commented on GitHub (Sep 5, 2019):

After playing with this some more, this looks like it only repros in the Terminal. This might actually just be another variant of WriteCharsLegacy2ElectricBoogaloo. I doubt we're putting the cursor in the right spot when we backspace around a linewrap like this.

cc @miniksa.

@zadjii-msft commented on GitHub (Sep 5, 2019): After playing with this some more, this looks like it _only_ repros in the Terminal. This might actually just be another variant of WriteCharsLegacy2ElectricBoogaloo. I doubt we're putting the cursor in the right spot when we backspace around a linewrap like this. cc @miniksa.
Author
Owner

@miniksa commented on GitHub (Sep 5, 2019):

Backspace around a line is a WriteCharsLegacy handled thing in the conhost. So your reasoning is sound. This should be linked to #780. Maybe not resolved until we're sure that it will resolve this too.

@miniksa commented on GitHub (Sep 5, 2019): Backspace around a line is a `WriteCharsLegacy` handled thing in the `conhost`. So your reasoning is sound. This should be linked to #780. Maybe not resolved until we're sure that it will resolve this too.
Author
Owner

@riverar commented on GitHub (Jan 15, 2020):

Still seeing this issue in 0.8.10091.0.

@riverar commented on GitHub (Jan 15, 2020): Still seeing this issue in 0.8.10091.0.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 15, 2020):

Thank you for the report. If we ever think we have explicitly fixed this bug, we’ll be sure to close this issue.

@DHowett-MSFT commented on GitHub (Jan 15, 2020): Thank you for the report. If we ever think we have explicitly fixed this bug, we’ll be sure to close this issue.
Author
Owner

@zadjii-msft commented on GitHub (Jan 27, 2020):

For the record, I've merged a combo of branches for #4354, #4289, and dev/migrie/f/conpty-wrapping-003 all together, and this still repros. It only repros in cmd.exe, and not bash however. I'm thinking it's possible that it's related shockingly to another bug where the cursor doesn't get moved by conpty on a frame where only the cursor changed position - maybe some combo of #4102/#3202. I'll keep digging.

@zadjii-msft commented on GitHub (Jan 27, 2020): For the record, I've merged a combo of branches for #4354, #4289, and `dev/migrie/f/conpty-wrapping-003` all together, and this still repros. It _only_ repros in `cmd.exe`, and not `bash` however. I'm thinking it's possible that it's related shockingly to another bug where the cursor doesn't get moved by conpty on a frame where only the cursor changed position - maybe some combo of #4102/#3202. I'll keep digging.
Author
Owner

@zadjii-msft commented on GitHub (Jan 27, 2020):

Hokay I've got a fix for this that I'm a little wary of, but I'm not sure it can be de-tangled from dev/migrie/f/conpty-wrapping-003. I'll investigate.

@zadjii-msft commented on GitHub (Jan 27, 2020): Hokay I've got a fix for this that I'm a little wary of, but I'm not sure it can be de-tangled from `dev/migrie/f/conpty-wrapping-003`. I'll investigate.
Author
Owner

@zadjii-msft commented on GitHub (Jan 28, 2020):

@<future me>:

This is the other side of the #357 coin actually.

Changing the fix for #357 from
814f4caf3e/src/renderer/vt/paint.cpp (L452-L467)

to

    if (_lastText.X < _lastViewport.RightExclusive())
    {
        _lastText.X += static_cast<short>(columnsActual);
    }

fixes the Terminal, but re-breaks using conhost as the Terminal (interop/vtpipeterm).

Maybe the Terminal is just wrong here (wouldn't surprise me). Especially considering this bug doesn't repro in conhost as a terminal. Perhaps this is delayed eol wrap? I'll look at the traces, see what's going on.

@zadjii-msft commented on GitHub (Jan 28, 2020): @\<future me>: This is the other side of the #357 coin actually. Changing the fix for #357 from https://github.com/microsoft/terminal/blob/814f4caf3eb3e44c37d3c35bb318423a5ef54a5d/src/renderer/vt/paint.cpp#L452-L467 to ```c++ if (_lastText.X < _lastViewport.RightExclusive()) { _lastText.X += static_cast<short>(columnsActual); } ``` fixes the Terminal, but re-breaks using conhost as the Terminal (interop/vtpipeterm). Maybe the Terminal is _just wrong_ here (wouldn't surprise me). Especially considering this bug doesn't repro in conhost as a terminal. Perhaps this is delayed eol wrap? I'll look at the traces, see what's going on.
Author
Owner

@ghost commented on GitHub (Feb 13, 2020):

:tada:This issue was addressed in #4403, which has now been successfully released as Windows Terminal Preview v0.9.433.0.🎉

Handy links:

@ghost commented on GitHub (Feb 13, 2020): :tada:This issue was addressed in #4403, which has now been successfully released as `Windows Terminal Preview v0.9.433.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.9.433.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1660