Search code examples
terminalxtermjs

Trying to use xTerm to send command or control key combinations


when using xTermJS, I am trying to use a UI to send commands, rather than just typing.. It's the project..

So, I sometimes need to send key combinations. Running on a Mac, I need to send "control+X" aka ^X

However, it doesn't seem like this is possible? At least not that anyone has published. IS it possible? I can use ASCII and hex characters to send, return, shift, arrow keys, etc. Can I do this "control" and/or "control+X" combination?


Solution

  • Ok, just as I was posting this querstion, I found the answer. I found it here: https://mw.lojban.org/papri/List_of_ASCII_letterals#ASCII_control_code_chart

    under ASCII control code chart, under ^X which has the ASCII code of 18, which I send to xTermJs as \x18. This immediately solved my problem.

    Seems like even these character combinations are defined as 1 ASCII character, and not 2 used together. In this case, my Control+X character is actually called a "Cancel" character.