Skip to content

Interactivity bugs post-#9820  #9955

Closed

Description

This is a tracking thread for things I probably broke in #9820. I'd rather not file 100 bugs for these

  • (A) Mousedown, select, SCROLL does a weird thing with endpoints that doesn't happen in stable
  • (B) Trackpad scrolling down with small increments seems buggy. But scrolling with a big increment goes fast? And scrolling with the mouse is fine. And trackpad scrolling in mouse mode is fine.
  • (C) Looks like there's a selection issue when you click and drag too quickly. Seems like the start endpoint doesn't always get set.
  • (D) Mysterious DX crash - this never reprod, so we're assuming it's unrelated
Mysterious DX crash

I experienced a crash when I killed DWM, and it took particularly long to recover

crash was on:

            RETURN_IF_FAILED(_dxgiFactory2->CreateSwapChainForComposition(_d3dDevice.Get(),
                                                                          &_swapChainDesc,
                                                                          nullptr,
                                                                          &_dxgiSwapChain));

in

0:000> k
 # Child-SP          RetAddr               Call Site
00 00000043`cef8ec80 00007ff9`3a4ac5a1     Microsoft_Terminal_Control!Microsoft::Console::Render::DxEngine::_CreateDeviceResources+0x47b [E:\BA\242\s\src\renderer\dx\DxRenderer.cpp @ 630] 
01 (Inline Function) --------`--------     Microsoft_Terminal_Control!Microsoft::Console::Render::DxEngine::GetSwapChain+0x14 [E:\BA\242\s\src\renderer\dx\DxRenderer.cpp @ 1010] 
02 00000043`cef8ed50 00007ff9`3a55667d     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::ControlCore::GetSwapChain+0x21 [E:\BA\242\s\src\cascadia\TerminalControl\ControlCore.cpp @ 1183] 
03 00000043`cef8ed80 00007ff9`3a4e1f71     Microsoft_Terminal_Control!winrt::Microsoft::Terminal::Control::implementation::TermControl::RenderEngineSwapChainChanged$_ResumeCoro$1+0x2bd [E:\BA\242\s\src\cascadia\TerminalControl\TermControl.cpp @ 582] 
04 (Inline Function) --------`--------     Microsoft_Terminal_Control!std::experimental::coroutine_handle<void>::resume+0x9 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29910\include\experimental\coroutine @ 107] 
05 (Inline Function) --------`--------     Microsoft_Terminal_Control!std::experimental::coroutine_handle<void>::operator()+0x9 [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29910\include\experimental\coroutine @ 99] 
06 00000043`cef8ee50 00007ff9`5e2623a6     Microsoft_Terminal_Control!winrt::impl::resume_apartment_callback+0x11 [E:\BA\242\s\src\cascadia\TerminalControl\Generated Files\winrt\windows.ui.core.h @ 1088] 
07 00000043`cef8ee80 00007ff9`5e2af93f     Windows_UI!<lambda_59517943c03487243f9bea31c6c1a784>::operator()+0x84 [onecoreuap\windows\advcore\winrt\onecoreiwindow\corewindow\common\dispatcher.cpp @ 908] 
08 00000043`cef8eeb0 00007ff9`7de6a440     Windows_UI!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::System::IDispatcherQueueHandler::*)(void)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::System::IDispatcherQueueHandler,Microsoft::WRL::FtmBase>,<lambda_59517943c03487243f9bea31c6c1a784>,-1>::Invoke+0xf [onecore\external\sdk\inc\wrl\event.h @ 354] 
09 00000043`cef8eee0 00007ff9`7de4229c     CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback+0x20 [mincore\coreui\dev\dispatcherqueue\wrtdispatcherqueue.cpp @ 903] 
0a (Inline Function) --------`--------     CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$::__l2::<lambda_a81ff790741c2a62f2197c2561f5fe49>::operator()+0x1f [mincore\CoreUI\Dev\System\Api\IExportMessageSession.cs @ 22] 

the _dxgiFactory2 was null. That's unexpected. It shouldn't be null.

Activity

  1. added
    Issue-BugIt either shouldn't be doing this or needs an investigation.
    Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
    on Apr 26, 2021
  2. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Apr 26, 2021
  3. DHowett commented on Apr 28, 2021

    @DHowett
    Member

    Looks like there's a selection issue when you click and drag too quickly.

    (Sorry for the terse body; I have to post this using powershell because of a new MSIT rule about personal devices :|)

  4. zadjii-msft commented on Apr 28, 2021

    @zadjii-msft
    MemberAuthor

    Looks like there's a selection issue when you click and drag too quickly.

    There sure is, just hit like 4 times this morning. Added to the list ☺️

  5. zadjii-msft commented on Apr 28, 2021

    @zadjii-msft
    MemberAuthor

    haha, found it

    if (_singleClickTouchdownPos)
    {
        // Figure out if the user's moved a quarter of a cell's smaller axis away from the clickdown point
        auto& touchdownPoint{ *_singleClickTouchdownPos };
        auto distance{ std::sqrtf(std::powf(cursorPosition.X - touchdownPoint.X, 2) + std::powf(cursorPosition.Y - touchdownPoint.Y, 2)) };
        const til::size fontSize{ _actualFont.GetSize() };
    
        const auto fontSizeInDips = fontSize.scale(til::math::rounding, 1.0f / _renderEngine->GetScaling());
        if (distance >= (std::min(fontSizeInDips.width(), fontSizeInDips.height()) / 4.f))
        {
            _terminal->SetSelectionAnchor(_GetTerminalPosition(touchdownPoint));
            // stop tracking the touchdown point
            _singleClickTouchdownPos = std::nullopt;
        }
    }
    if (_singleClickTouchdownPos)
    {
        // Figure out if the user's moved a quarter of a cell's smaller axis away from the clickdown point
        auto& touchdownPoint{ *_singleClickTouchdownPos };
        float dx = ::base::saturated_cast<float>(pixelPosition.x() - touchdownPoint.x());
        float dy = ::base::saturated_cast<float>(pixelPosition.y() - touchdownPoint.y());
        auto distance{ std::sqrtf(std::powf(dx, 2) +
                                  std::powf(dy, 2)) };
    
        const auto fontSizeInDips{ _core->FontSizeInDips() };
        if (distance >= (std::min(fontSizeInDips.width(), fontSizeInDips.height()) / 4.f))
        {
            _core->SetSelectionAnchor(terminalPosition);
            // stop tracking the touchdown point
            _singleClickTouchdownPos = std::nullopt;
        }
    }
            _terminal->SetSelectionAnchor(_GetTerminalPosition(touchdownPoint));

    vs

            _core->SetSelectionAnchor(terminalPosition);

    We're now using the location of the drag event as the selection anchor, instead of the location that the user initially clicked. Oops. Now to write a test.

  6. zadjii-msft commented on Apr 28, 2021

    @zadjii-msft
    MemberAuthor

    Oof. B is hard, I think. The touchpad sends very many small scroll deltas, less than one row at a time. The control scrollbar can store a double, so small deltas can accumulate. Originally, these would accumulate in the scrollbar, and we'd only read that out as an int in the scrollbar updater, which is throttled.

    In the interactivity split, there's no place for us to store that double. We immediately narrow to an int for ControlInteractivity::_updateScrollbar.

    Theoretically, we could store a double in Interactivity that's a fake scrollbar position, to accumulate to. Then, ControlInteractivity would need to listen to scroll events from the core, unsure how easy that is right now...

  7. 2 remaining items

  8. added 2 commits that reference this issue on Apr 28, 2021
    33d29fa
    0fefc5b
  9. removed
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Apr 29, 2021
  10. DHowett commented on Jul 19, 2021

    @DHowett
    Member

    Point [E] may cause an accessibility regression in the 1.11 timeframe.

  11. added a commit that references this issue on Aug 4, 2021
  12. ghost added
    In-PRThis issue has a related PR
    on Aug 4, 2021
  13. ghost closed this as completedin #10874on Aug 11, 2021
  14. ghost removed
    In-PRThis issue has a related PR
    on Aug 11, 2021
  15. ghost added a commit that references this issue on Aug 11, 2021
    121fb73
  16. ghost added
    Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.
    on Aug 11, 2021
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.)Issue-BugIt either shouldn't be doing this or needs an investigation.Priority-1A description (P1)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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions