Skip to content

De-duplicate code for TerminalDispatch and AdaptDispatch #3849

Closed
@zadjii-msft

Description

@zadjii-msft

Both these classes are doing a lot of the nearly same work at this point. We should probably not, and have more common implementations somehow.

IIRC, when I was writing it, I think part of the idea was to move ITerminalApi up and out of the Terminal to be shared, then have one Dispatch that calls into the API, then an adapter between that API and the conhost API

This is a super crude diagram

         +------------------+
         |  OutputEngine    |
         +---------+--------+
                   |
         +---------v--------+
         | OutputDispatch   |
         +--------+---------+
                  |
         +--------v---------+
         |   ITerminalApi   |
         +---+------------+-+
             |            |
             |            |
+------------v--+     +---v------------+
|  Terminal     |     |  HostAdapter   |
+---------------+     +-------+--------+
                              |
                      +-------v--------+
                      |   outputStream |
                      |      +         |
                      |      |         |
                      |      v         |
                      |   getset       |
                      +----------------+

In this model, Terminal and HostAdapter both implement ITerminalApi, so there only needs to be one Dispatcher. HostAdapter then calls into the conGetSet API we already have.

This would pretty horribly break tests that test the existing structure :/

I could be horribly off base with this though. I came up with this idea like 9 months ago and never wrote it down.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CodeHealthIssues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.Area-VTVirtual Terminal sequence supportIssue-TaskIt's a feature request, but it doesn't really need a major design.Product-ConhostFor issues in the Console codebaseProduct-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions