On Wed, Oct 23, 2002 at 02:12:25AM +1000, Russell wrote: > I'm testing out some terminal escape sequences as in: > http://cns.georgetown.edu/~ric/howto/Xterm-Title/ctlseqs.txt > Just try typing: echo -ne "\033[2t" into an xterm;) > > Anyway, how can i type control sequences into an xterm > without the cursor moving? When i press ESC, it gets > intercepted by the shell. ESC-[ doesn't work either. > > Is there a way to echo a string from one xterm into > another xterm?
I don't understand the problem you're having. You demonstrate how to generate output sequences containing ESC (using echo), then ask how to input control sequences. Are you attempting to generate the VT220 "uparrow" keystroke manually? If so, you are going to have a hard time doing so by typing ESC [ A, because of the software layering. Here's how VTxx emulation works with xterm: You press a key (let's use Up as an example). The keyboard sends a scancode to the motherboard keyboard controller. The kernel processes the data, then sends the scancode to the X server. The X server converts the scancode to a KeyPress event, which says "the key labelled 'Up' was pressed at time 391517935". It sends this event to the xterm process. XTerm looks for 'Up' in its internal tables, and converts it to a string; in this case, three bytes, ESC [ A. XTerm sends these three bytes down the pseudo-tty; the kernel thinks it over, and delivers these three bytes to a process (such as bash, or vim, or cat). An app such as vim or bash does its own echoing, so nothing is printed back to the pty by the system (because the echo* tty settings are turned off; run "stty" and read its man page). The application interprets the bytes however it wants, and perhaps prints something back to the xterm. The output might consist of the same bytes ESC [ A, in which case xterm would move the cursor up one line. If you run cat, it does not place the pty in raw mode, and so the kernel takes care of handling echo and control characters for the app. Since ptys in linux default to echoctl, the kernel generates the four bytes ^ [ [ A, and sends them back down the pty to xterm, which displays them. If you do "stty -echoctl; cat" the kernel will echo back an up-arrow as three bytes ESC [ A, and xterm will move the cursor. (Glossary: tty is teletype, the generic term for a port via which an application might talk to a user. pty is pseudo tty, a fake tty which is used by apps like xterm which want to fool other apps into thinking they're talking to a user.) HTH -andy _______________________________________________ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert