terminal
terminal copied to clipboard
SendInput with newlines in it outputs the text backward
Windows Terminal version
latest build of main
Windows build number
No response
Other Software
Powershell 7
Steps to reproduce
Make a 'sendInput' command with newlines in the settings json, example:
"command":
{
"action": "sendInput",
"input": "a\nb\nc"
},
"name": "test sendinput"
Invoke the command in terminal
Expected Behavior
The text output should be a, then b, then c as below
Actual Behavior
The actual output is reversed, and goes c->b->a
Update: with command prompt instead we get:
I.e. the text is in the correct order but there's no new lines at all
Sooo this is actually adjacent to a paste issue we had! You want \r or both \r\n.
Should sendInput maybe just behave like ENABLE_PROCESSED_INPUT is enabled?
Edit: Oh, but that might make sending precise inputs harder... hmm...
My thought is that InputStateMachineEngine::_DoControlCharacter attempts to translate \n to ctrl+j. But that doesn't seem like what's happening, because ctrl+j is bound to MenuComplete (at least, on my machine). I'd probably need to step through it more precisely.
| Key | Function | Description |
|---|---|---|
| Ctrl+Enter | InsertLineAbove | Inserts a new empty line above the current line without attempting to execute the input |
Now, that's pretty dang close to what we're seeing. That would also explain why nothing happens in CMD - ctrl+enter doesn't do anything there.
@