Skip to content

Introduce abstraction layer between TermControl and TerminalCore (aka Interactivity) #6842

Closed

Description

Description of the new feature/enhancement

We have some redundant code between the WPF Control and the UWP TermControl. This indicates a missing layer of abstraction between the TerminalCore and the TermControl. Some benefits that we could/would get from introducing an "interactivity" layer includes...

  • better parity between both controls
  • less duplicated code
  • better separating scrolling in both layers

Proposed technical implementation details (optional)

Specific interactions that could be abstracted better include (but are not limited to)...

  • Selection
  • Scrolling
  • VT Mouse Mode (sorta)

\cc Dustin L. Howett (@DHowett)

Activity

  1. added
    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.
    Area-CodeHealthIssues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.
    on Jul 8, 2020
  2. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Jul 8, 2020
  3. added
    Area-OutputRelated to output processing (inserting text into buffer, retrieving buffer text, etc.)
    Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
    Area-WPFControlThings related to the WPF version of the TermControl
    and removed
    Area-OutputRelated to output processing (inserting text into buffer, retrieving buffer text, etc.)
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Jul 9, 2020
  4. zadjii-msft commented on Mar 31, 2021

    @zadjii-msft
    Member

    Alright, as of 2ac8318, this is fundamentally pulled into 3 files, but there's still a lot of work to do. I'm using this comment to track that.

    • Move ControlCore and ControlInteractivity to Microsoft.Terminal.Core so I can unittest them
      • didn't exactly do that, because that was WAY crazier. But we got tests!
    • Mousewheel transparency is busted
    • Acrylic actually doesn't work at all
    • Manually print hyperlink to console
    • auto-detecting hyperlinks doesn't work
      • oh good this actually has a TODO!
    • Trying to make a second selection while one is active is weird
    • Actually making a second selection while one is active is impossible? (OH BUT IT'S BUSTED IN 1.8.892.0 AND 1.8.921.0 - fixed in Fix marking of new selection start #9727)
    • multi-click selection does seem to work
    • The scrollbar never moves!
    • Scrolling with the mouse is fine. With the trackpad though: Scrolling up seems to work, but scrolling down is very unsmooth
    • OH GOD just typing dir (presumably causing a scroll) HANGS THE TERMINAL
    • wheel scrolling of the font size seems to work
    • keybinding changing of the font size seems to work
    • changing DPI seems fine
    • Find dialog opens, works
    • Closing a tab with right-click close tab reliably crashes the Terminal
      • some crash in ITerminalConnection)->remove_TerminalOutput(impl::bind_in(token))); when exiting with VS debugger attached
      • The _connection is already null in ControlCore::Close
    • Remove Windows::UI::Input::PointerPoint
      • PointerPressed
      • PointerMoved
      • PointerReleased
      • MouseWheel
      • Touched
      • TouchMoved
      • TouchReleased
    • single click = no selection
    • single click and drag = selection starting from first point
    • single click in unfocused pane and drag = focus pane, selection starting from first point
    • double-click = selects a whole word
    • triple-click = selects a whole line
    • double-click and drag = selects a whole word, drag selects whole words
    • triple-click and drag = selects a whole line, drag selects whole lines
    • Shift single-click = defines start point
    • second Shift single-click = defines end point
    • Shift double-click = selects entire word
    • Shift triple-click = selects entire line
    • Shift double-click and drag = selects entire word, drag selects whole words
    • With existing selection: single-click outside the selection and drag = establishes a new selection starting from the click point
    • toggling renderer settings at runtime (without a shader set unset<->retro)
    • toggling renderer settings at runtime (with a shader set unset<->shader)
    • Hot reloading settings
      • Font
      • Antialiasing ❌ OH NO - seemingly a DPI change fixes this though. So something in the stack there is wrong. Not triggering a redraw, but triggering a font change?
        • Actually, this NEVER hot reloaded! We need to force the _d2dDeviceContext to the new setting
      • Background color
      • BG image
      • retro effect
      • Acrylic opacity
      • Scheme
      • CopyOnSelect
    • Hot reloading the settings seemed to make text with a background color disappear. But it didn't happen in both windows. ?
      • this never reprod again. Must've been something else.
      • I saw this come back after merging Add support for a profile to specify an "unfocused" appearance #8392. Might have actually been caused by that PR, need to investigate.
      • The two repros I saw were:
        • Change the BG to have an image - some of the text was temporarily invisible. not all of it, and not only the text with a BG color.
        • Mouse wheel the opacity - again once triggered the invisibility, but might have been a settings reload that hadn't yet propagated.
    • Right-click copy w/o CopyOnSelect
    • CopyOnSelect
    • read-only mode doesn't work at all currently.
      • keyboard input
      • mouse input in VT mode
    • The taskbar is fucky Progress state doesn't update correctly between panes #9743
      • Setting the taskbar progress to indeterminate changes the taskbar, but not the tab icon
      • Set the taskbar progress to indeterminate in one tab, and switch to another tab. The taskbar still shows indeterminate. Neither tab has the spinner icon.
      • Set the taskbar progress to indeterminate in one pane, and switch to another pane. The taskbar still shows indeterminate. Neither pane gets the spinner icon.

    Post- 5dc1632

    • The font weight doesn't load right initially

    Other scenarios to check:

    • Click+drag out of the window to autoscroll the buffer
    • snap to grid - does that still work?
      • Seems good on 96 DPI
      • Might not work on high DPI
        • nevermind, this is behaving the same as it did before
      • Is the window supposed to resize when mouse scrolling the font size with snap to grid? because it doesn't currently.
        • It is not supposed to. So that's a good sign.
    • Mouse mode: Shift single-click = defines start point
    • Mouse mode: second Shift single-click = defines end point
    • Mouse mode: Shift double-click = selects entire word
    • Mouse mode: Shift triple-click = selects entire line
    • Mouse mode: Shift double-click and drag = selects entire word, drag selects whole words
    • Does actual mouse mode still work?
    • Prevent mouse dragging from dismissing existing selection Prevent mouse dragging from dismissing existing selection #9790
    • more...

    Tests to write:

    • Changing opacity with mouse wheel
    • Closing the ControlCore, then dtoring it
    • Scrolling with the mouse
    • Scrolling by panning with touch
    • scroll initiated by the terminal
    • scrollbar initiated scrolling
    • single click = no selection
    • single click and drag = selection starting from first point
    • With existing selection: single-click outside the selection and drag = establishes a new selection starting from the click point
    • Prevent mouse dragging from dismissing existing selection Prevent mouse dragging from dismissing existing selection #9790
  5. ghost added a commit that references this issue on Apr 5, 2021
  6. ghost added
    In-PRThis issue has a related PR
    on Apr 14, 2021
  7. DHowett commented on Apr 22, 2021

    @DHowett
    Member
    • moving between DPIs does not introduce any issues in VT mouse events, rendering, scrolling, dragging, etc
  8. ghost closed this as completedin #9820on Apr 27, 2021
  9. ghost removed
    In-PRThis issue has a related PR
    on Apr 27, 2021
  10. ghost added
    Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.
    on Apr 27, 2021
  11. ghost added a commit that references this issue on Apr 27, 2021
    8910a16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-CodeHealthIssues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Area-WPFControlThings related to the WPF version of the TermControlIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions