Skip to content

[1.19] Shell integration marks are totally in the wrong place #16034

Closed

Description

This was on
Windows Terminal Canary
Version: 1.19.2643.0

shell-integration-crazy-wrong

Looks like the marks are like... off by one?

Possible culprits:

Activity

  1. added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    Needs-Tag-FixDoesn't match tag requirements
    on Sep 26, 2023
  2. zadjii-msft commented on Sep 26, 2023

    @zadjii-msft
    MemberAuthor

    Looks like this is also busted in v1.19.2652.0

  3. added
    Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
    and removed
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Sep 27, 2023
  4. zadjii-msft commented on Sep 28, 2023

    @zadjii-msft
    MemberAuthor

    oh no, scrolling is really badly messed up

    image
    image
    image

  5. zadjii-msft commented on Sep 28, 2023

    @zadjii-msft
    MemberAuthor

    Bisecting. Starting by looking for a good commit around

    ❔ ✅ ❌

  6. zadjii-msft commented on Sep 28, 2023

    @zadjii-msft
    MemberAuthor

    4ddfc3e is the first bad commit
    commit 4ddfc3e

    COOKED_READ_DATA: Fix scrolling under ConPTY (#15930)

  7. zadjii-msft commented on Sep 28, 2023

    @zadjii-msft
    MemberAuthor

    Okay this is 100% due to:

    // ConPTY translates scrolling into newlines. We don't want that during cooked reads (= "cmd.exe prompts")
    // because the entire prompt is supposed to fit into the VT viewport, with no scrollback. If we didn't do that,
    // any prompt larger than the viewport will cause >1 lines to be added to scrollback, even if typing backspaces.
    // You can test this by removing this branch, launch Windows Terminal, and fill the entire viewport with text in cmd.exe.
    if (needsConPTYWorkaround)
    {
    buffer.SetAsActiveBuffer(false);
    buffer.IncrementCircularBuffer(buffer.GetCurrentAttributes());
    buffer.SetAsActiveBuffer(isActiveBuffer);
    if (isActiveBuffer && renderer)
    {
    renderer->TriggerRedrawAll();
    }
    }

    Leonard Hecker (@lhecker) how load bearing is that? I know that comment sounds super scary above it, but manually setting needsConPTYWorkaround to false definitely fixes the scrolling and marks issue.

  8. lhecker commented on Sep 28, 2023

    @lhecker
    Member

    I'll fix #16044 and this issue in a single PR.
    For #16044 I'll make it so that appending text only reprints the minimum amount of text that's necessary and for this issue I'll revert the above code entirely.

    After all that, I'll reopen #15899 and leave it unfixed for the foreseeable future, because as much of a significant bug it is, I feel like fixing it is too difficult for the impact it has. To properly fix it, it always either required us to sacrifice on our i18n or to implement a pager, both of which are a pain to do. We have other issues that are much easier to fix and are hit much more often, right?
    And if we don't reprint the entire prompt when appending text, I don't think it'll be hit very often. After all, cmd.exe always reprinted the entire prompt when inserting in the middle...

  9. zadjii-msft commented on Sep 28, 2023

    @zadjii-msft
    MemberAuthor

    Totally cool with that. Tossing this one over to you then ☺️

  10. added a commit that references this issue on Oct 24, 2023
    e1c69a9
  11. added a commit that references this issue on Oct 26, 2023
    c2fde69
  12. added a commit that references this issue on Dec 7, 2023
    8e94596
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)In-PRThis issue has a related PRIssue-BugIt either shouldn't be doing this or needs an investigation.Needs-Tag-FixDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.Severity-BlockingWe won't ship a release like this! No-siree.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions