Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendInput should be previewable #12861

Closed
Tracked by #13445 ...
zadjii-msft opened this issue Apr 8, 2022 · 4 comments · Fixed by #17386
Closed
Tracked by #13445 ...

sendInput should be previewable #12861

zadjii-msft opened this issue Apr 8, 2022 · 4 comments · Fixed by #17386
Assignees
Labels
Area-CmdPal Command Palette issues and features Area-Settings Issues related to settings and customizability, for console or terminal Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.

Comments

@zadjii-msft
Copy link
Member

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

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Apr 8, 2022
@zadjii-msft zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. labels Apr 8, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Apr 8, 2022
@zadjii-msft zadjii-msft added the Area-CmdPal Command Palette issues and features label Apr 8, 2022
@zadjii-msft zadjii-msft added this to the Backlog milestone Apr 8, 2022
@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. good first issue This is a fix that might be easier for someone to do as a first contribution labels Apr 8, 2022
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Apr 8, 2022
@zadjii-msft
Copy link
Member Author

zadjii-msft commented 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 zadjii-msft modified the milestones: Backlog, Terminal v1.15 Apr 29, 2022
@zadjii-msft zadjii-msft self-assigned this Jun 21, 2022
@DHowett
Copy link
Member

DHowett commented Jun 29, 2022

Curious how this will handle sendInputd escape sequences!

@zadjii-msft
Copy link
Member Author

zadjii-msft commented Aug 8, 2023

Protip, revert 7c3fd2a

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 8f0b6f8

@zadjii-msft zadjii-msft removed the good first issue This is a fix that might be easier for someone to do as a first contribution label Aug 8, 2023
zadjii-msft added a commit that referenced this issue Aug 8, 2023
@zadjii-msft
Copy link
Member Author

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 zadjii-msft modified the milestones: Terminal v1.20, Up Next Oct 4, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Jun 6, 2024
@zadjii-msft zadjii-msft modified the milestones: Up Next, Terminal v1.22 Jun 11, 2024
@zadjii-msft zadjii-msft self-assigned this Jun 11, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 11, 2024
This adds support for previewing snippets, again. This time, with the
new TSF implementation. Leonard pointed me in the right direction with
this - he's the one who suggested to have a second `Composition` just
for previews like this.

Then we do some tricky magic to make it work when we're using
commandlines from shell integration, or you've got the ghost text from
powershell, etc. Then we visualize the control codes, just so they
aren't just U+FFFE diamonds.

Closes #12861
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CmdPal Command Palette issues and features Area-Settings Issues related to settings and customizability, for console or terminal Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants