>Terminal input and output
The terminal engine receives display data from one of 2 sources.
can be used to feed output from the running application directly into the terminal emulator. Any such input will not be seen by any subordinate application, but will behave as if that application had generated it. This normally used when the ZvtTerm is only being used as a local output device.
If a child process has been launched via zvt_term_forkpty(), then it will be executing asynchronously to the GUI application. If it generates any output while it is executing this will automatically be processed and displayed by the widget during the gtk event loop processing. This will never generate output if zvt_term_forkpty() has not executed successfully.
Any input from any of the sources is treated the same - as xterm escape sequences or escape sequence fragments and simple text. It would generally not make sense to use both methods of display generation at the same time as the display state may not be known between calls to the parser.
Within the ZvtTerm object definition there is available a file descriptor which is assigned to the application to "add" extra keystrokes to the child's input. This file descriptor is stored in term->vx->vt.keyfd. Input to this file descriptor will be processed as if they were typed in by the user. zvt_term_feed() cannot be used for this purpose as it by-passes the child's input and output streams and writes directly to the display engine. Of course, this file descriptor is only valid if zvt_term_forkpty() was executed successfully on the terminal object.
Example 1. Adding characters to the input stream
/* feeds in 'ls -l\r\n' into the current child process */ write(term->vx->vt.keyfd, "ls -l\r\n", sizeof("ls -l\r\n"));