windows terminal move cursor back by x characters

I have made a custom action in windows terminal

{
  "command": {
    "action": "sendInput",
    "input": "docker exec -it  /bin/bash"
  },
  "keys": "ctrl+shift+c"
}

works great would it be possible to mvoe the cursor back 10 places so i can start typing the container name after the command is printed out, like:

docker exec -it | /bin/bash

I know you can do /r to execute a return but can not find any info on other things like arrow keys or something like that


According to the comments, Windows Terminal does not implement fully the ANSI Escape Codes.

You would in this case need to repeat the left-arrow code 10 times, while according to the standard this could have been done with one escape sequence.

This value for "input" should have worked:

docker exec -it  /bin/bash\u001b[10D

The code ESC[#D is for moving the cursor left # columns.

This works instead, with the left-arrow sequence repeated 10 times:

docker exec -it  /bin/bash\u001b[1D\u001b[1D\u001b[1D\u001b[1D\u001b[1D\u001b[1D\u001b[1D\u001b[1D\u001b[1D\u001b[1D

References:

  • Custom actions in Windows Terminal
  • ANSI Escape Sequences