Search code examples
terminaltclsttyrlwrap

How to delegate key press handling to rlwrap in raw mode terminal with tcl


I use stty raw -echo in my tcl terminal program. What I want is to do some actions for only a few key press events such as Tab. For the rest of the key press events I want to delegate to rlwrap or other default handling program, such as to move cursor to left hand side and insert text in where the cursor is, or Ctrl+C to terminate the program. Is there a way to do it?


Solution

  • There is an option in stty that handles signals for you which is the isig option. Also, -opost process "\n" to "\r\n" for you.

    stty raw -echo isig
    

    Another choice is to use explicit -icanon min 1 time 0 instead of raw option.