2

My knowledge on terminal emulators is a little sketchy, and in an effort to learn more about them, I thought I could experiment with some of the escape sequences and see what I can do. One of the things I thought of to try was (pseudo-code):

pushTerminalState()
writeSomeDataToTheScreen()
popTerminalStateToRestoreItToTheWayItWasBefore()

In researching how to do this, I came across two control functions

  1. DECTSR - terminal state request
  2. DECRSTS - restore terminal state

However, I am unsure how to use them. For the DECTSR function I am trying process.stdout.write('\x1B1$u'). According to the note on the DECTSR page, this should give a "response", but I am unaware as to where I should "read" the response from? I naively attempted to read from STDIN, but as expected I only received keys from my terminal.

Any tips on what I am doing wrong?

Jonathan Apodaca
  • 5,458
  • 6
  • 30
  • 41
  • 1
    If your output is buffered, you have to flush it (to get all of the request to the terminal). Also, your *stdin* may not be reading from the actual device... – Thomas Dickey Aug 23 '17 at 19:50
  • @OP These sequences have nothing to do with your question. Perhaps 'switch to the alternate screen' and 'switch back' would be closer. – Lorinczy Zsigmond Aug 29 '17 at 11:30
  • they are supported only on VT320 and up (https://vt100.net/emu/ctrlseq_dec.html), it's unlikely that your emulator supports them. – sendmoreinfo Dec 21 '17 at 18:19

0 Answers0