I see a similar question on stackoverflow:
Someone recommends conspy. However, it seems that conspy doesn't work for pts terminal.
I also tried the way to use
strace to get the keys pressed here, but I found the result quite difficult to read.
Does anyone have ideas about this?