sendInput should be previewable #17188

Closed
opened 2026-01-31 05:34:47 +00:00 by claunia · 4 comments
Owner

Originally created by @zadjii-msft on GitHub (Apr 8, 2022).

Originally assigned to: @zadjii-msft on GitHub.

See #9818, 60f63b09cc, #3121. I literally have this prototyped, just need to check it in. It's important for future issues...

Originally created by @zadjii-msft on GitHub (Apr 8, 2022). Originally assigned to: @zadjii-msft on GitHub. See #9818, 60f63b09cc59f1a46d142952f49dbf7599bc4cf8, #3121. I literally have this prototyped, just need to check it in. It's important for future issues...
Author
Owner

@zadjii-msft commented on GitHub (Apr 29, 2022):

More cleanly pulled to its own branch: https://github.com/microsoft/terminal/pull/new/dev/migrie/f/12861-preview-input

Note: You'll also want the backspace trimming thing. That merged into TSFControl in 0f32692 but I don't know where its origin was before that.


    void TSFInputControl::ManuallyDisplayText(const winrt::hstring& text)
    {
        _focused = !text.empty();
        Canvas().Visibility(text.empty() ? Visibility::Collapsed : Visibility::Visible);

        _inputBuffer.clear();
        // _editContext.NotifyFocusLeave();
        _activeTextStart = 0;
        _inComposition = false;

        // HACK trim off leading DEL chars.
        std::wstring_view view{ text.c_str() };
        const auto strBegin = view.find_first_not_of(L"\x7f");
        if (strBegin != std::wstring::npos)
        {
            view = view.substr(strBegin * 2);
        }

        TextBlock().Text(winrt::hstring{ view });
        TextBlock().UpdateLayout();
        TryRedrawCanvas();
    }
@zadjii-msft commented on GitHub (Apr 29, 2022): More cleanly pulled to its own branch: https://github.com/microsoft/terminal/pull/new/dev/migrie/f/12861-preview-input Note: You'll also want the backspace trimming thing. That merged into TSFControl in 0f32692 but I don't know where its origin was before that. ```c++ void TSFInputControl::ManuallyDisplayText(const winrt::hstring& text) { _focused = !text.empty(); Canvas().Visibility(text.empty() ? Visibility::Collapsed : Visibility::Visible); _inputBuffer.clear(); // _editContext.NotifyFocusLeave(); _activeTextStart = 0; _inComposition = false; // HACK trim off leading DEL chars. std::wstring_view view{ text.c_str() }; const auto strBegin = view.find_first_not_of(L"\x7f"); if (strBegin != std::wstring::npos) { view = view.substr(strBegin * 2); } TextBlock().Text(winrt::hstring{ view }); TextBlock().UpdateLayout(); TryRedrawCanvas(); } ```
Author
Owner

@DHowett commented on GitHub (Jun 29, 2022):

Curious how this will handle sendInputd escape sequences!

@DHowett commented on GitHub (Jun 29, 2022): Curious how this will handle `sendInput`d escape sequences!
Author
Owner

@zadjii-msft commented on GitHub (Aug 8, 2023):

Protip, revert 7c3fd2aeec

I backed it out because it:

  • worked wacky with wide glyphs / unicode surrogates and the backspacing code
  • the backspacing code was hacky kinda always
  • it didn't always scale and offset to the correct position
  • didn't really handle line wrapping well
  • with the pwsh ghost text, was very confusing

you may also need 8f0b6f8a2

@zadjii-msft commented on GitHub (Aug 8, 2023): Protip, revert 7c3fd2aeecf57d0320ff915d7c8c68e10acb1763 I backed it out because it: * worked wacky with wide glyphs / unicode surrogates and the backspacing code * the backspacing code was hacky kinda always * it didn't always scale and offset to the correct position * didn't really handle line wrapping well * with the pwsh ghost text, was very confusing --- you may also need 8f0b6f8a2
Author
Owner

@zadjii-msft commented on GitHub (Aug 17, 2023):

Punting out of 1.19. This was wacky as-is. We may want to come back to re-try this with more runway.

@zadjii-msft commented on GitHub (Aug 17, 2023): Punting out of 1.19. This was wacky as-is. We may want to come back to re-try this with more runway.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17188