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

Pasting a multiline block of text does not autoMarkPrompts #15813

Closed
Tracked by #15057 ...
zadjii-msft opened this issue Aug 9, 2023 · 6 comments
Closed
Tracked by #15057 ...

Pasting a multiline block of text does not autoMarkPrompts #15813

zadjii-msft opened this issue Aug 9, 2023 · 6 comments
Assignees
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.

Comments

@zadjii-msft
Copy link
Member

  1. Turn on "experimental.autoMarkPrompts": true, and "experimental.rightClickContextMenu": true,
  2. turn on shell integration too. Just in general always, it's goodness.
  3. Copy the following
command-one
dir
command-two
command-three
  1. Paste it. Accept the warning.
  2. Try to right-click "select output" or command.
  3. Observe that it no worky.

Surely, when we paste text, we're not going through the same path in Terminal.cpp that marks enter

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Product-Terminal The new Windows Terminal. labels Aug 9, 2023
@zadjii-msft zadjii-msft added this to the Terminal v1.19 milestone Aug 9, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 9, 2023
@carlos-zamora carlos-zamora removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 9, 2023
@zadjii-msft
Copy link
Member Author

Note: don't do this for

  • the alt buffer
  • bracketed paste

@zadjii-msft
Copy link
Member Author

Similarly, this doesn't work if you sendInput(foo\rbar\nbaz). None of them seem to work to mark.

I'm guessing it's because sendInput comes in through the paste handler. Might be able to fix

@DHowett
Copy link
Member

DHowett commented May 10, 2024

I am somewhat anti-this. Most multi-line pastes are into things that aren't shells probably...

@zadjii-msft
Copy link
Member Author

The alt buffer doesn't have marks at all, so there's that to mitigate some concerns.

FWIW I even tried doing sendInput with \u001b[13;28;13;1;32;1_\u001b[13;28;13;0;32;1_ (enter) and even that didn't mark the commands ended.

(I may be able to fake this better with powershell)

@zadjii-msft
Copy link
Member Author

Okay, well, this actually will just never work (for probably obvious reasons). I'm focusing narrowly on the sendInput scenario here, but it's equally obvious for paste.

When we call ControlCore::SendInput, we write the text directly to the connection. We could split that on each \r, and then try to automark on each of those newlines, BUT: we don't know when the output of each of those will be. We'd write a block, mark the line, write a block, mark, etc, probably multiple times before we got the first bit back out of the first command. When we get that block, nothing will actually get emitted before we write the whole block.

uhg.

Goddard, options:

  • COOKED_READ emits a 133;C when it processes an enter
    • dangerous, certainly too dangerous for Build)
  • add some sort of commands param to sendInput, and that will wait to the next prompt between sending elements in the commands array
    • deeply underspec'd
  • definitely just cut this from the demo? Or at least blow past the fact that the command also gets selected
  • add a sleep action that literally just Sleeps for that timeout, so that I can then multipleActions([sendInput, sleep, ]) ah fuck see that still doesn't work. Still doesn't mark the command
  • Maybe see if I can bodge PWSH into supporting 133;C without automarking

@zadjii-msft
Copy link
Member Author

You know what, in light of how painful some of the proposed fixes are, and how specifically automarkPrompts==="mark when you press enter", then I'm gonna close this out as "by design". Kinda unexpected, and I could be convinced the other way, but only if there was a good solution proposed.

@zadjii-msft zadjii-msft closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
@zadjii-msft zadjii-msft removed this from the Terminal v1.21 milestone May 14, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label May 14, 2024
@zadjii-msft zadjii-msft added Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons. and removed Needs-Tag-Fix Doesn't match tag requirements labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.
Projects
None yet
Development

No branches or pull requests

3 participants