Skip to content

Understand why the PTY might delete and then re-add spaces on certain lines #5430

Closed as not planned

Description

Notes from #5398

SPACES REMOVED WHEN:
* line was not wrapped

AND

* It is optimal to prefer ECH/EL
* We are not on a new bottom line
* We did not clear all this frame
OR
* We cleared all this frame
OR
* It is a new bottom line and we are on it

SPACES RE-ADDED WHEN:
* It is not optimal to prefer ECH/EL
OR
* It is a new bottom line
OR
* We cleared all this frame

AND
* It is a new bottom line and we are on it
* The line had spaces at the end.
* We deleted the spaces previously <<< NEW IN #5398

Originally posted by Dustin L. Howett (MSFT) (@DHowett-MSFT) in #5398 (comment)

While we're looking at this, we'll want to investigate how to consolidate the space add/remove logic so that we can make maximal use of the buffer already passed to us (like: write it out in full if it has spaces we want to keep, etc.)

Notes from Mike Griese (@zadjii-msft)

I can't remember tbh. This screams organic growth to me - I think we first just decided to do ECH and removing spaces, when we didn't have wrapping (and spaces didn't matter). Then we did some deferring the cursor movement & not erasing optimizations in 20H1, which added cases where we wouldn't ECH. Now we're adding cases where we still need the spaces. I suppose if we'd written it from scratch now, accounting for wrapping, we'd do it better.

I'd TODO it tbh.

I bet we were trying to optimize out the cursor positioning that we'd do after a new line is printed. If we did optimize that scenario, and used ECH to erase some spaces, we also used CUF to move the cursor. However, if we couldn't do that, we'd still want to leave the cursor in the right place...

yea we probably should have just not removed them in the first place.

Activity

  1. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Apr 20, 2020
  2. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Apr 20, 2020
  3. added
    Area-CodeHealthIssues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.
    Issue-TaskIt's a feature request, but it doesn't really need a major design.
    Product-ConptyFor console issues specifically related to conpty
    on Apr 20, 2020
  4. ghost removed
    Needs-Tag-FixDoesn't match tag requirements
    on Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CodeHealthIssues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.Issue-TaskIt's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsPriority-2A description (P2)Product-ConptyFor console issues specifically related to conpty

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions